How to get HTML from a beautiful soup object How to get HTML from a beautiful soup object python python

How to get HTML from a beautiful soup object


Just get the string representation:

html_content = str(listing)

This is a non-prettified version.

If you want a prettified one, use prettify() method:

html_content = listing.prettify()