Clean up dirty HTML
beautiful_print.py
# -*- coding: utf-8 -*-
from beautiful_print import beautiful_print
ugly_html = """
<html> <body> <div>it sure is hot inside this div! <em>right?</em>
</div> <p>Yep!</p> <img src=fire.gif></img> </body> </html>
"""
print beautiful_print(ugly_html)
'''
<html>
<body>
<div>
it sure is hot inside this div! <em>right?</em>
</div>
<p>
Yep!
</p>
<img src="fire.gif"/>
</body>
</html>
'''
Recommended Posts