Wednesday, October 22, 2008

How to pretty-print an "ugly HTML" document

Using Python and the BeautifulSoup module:

from BeautifulSoup import BeautifulSoup
html = '' # insert UHTML here
soup=BeautifulSoup(html)
print soup.prettify()

No comments: