On Wed, Mar 07, 2007 at 09:14:19PM +0000, Eur Ing Chris Green wrote:
I'm trying to understand and unpick an HTML template file, an automatic 'beautifier' would help no end, are there any out there?
There is a python library called beautiful soup which can do this..
alan@hactar:~$ python Python 2.5 (release25-maint, Mar 5 2007, 20:06:09) [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import urllib2 from BeautifulSoup import BeautifulSoup page = urllib2.urlopen("http://google.com/") soup = BeautifulSoup(page) print soup.prettify()
<html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title> Google </title> <style> <!--
--------------------------8<----------------------
<p> <font size="-2"> ©2007 Google </font> </p> </center> </body> </html>
Cheers, Al.