PDA

View Full Version : Html parse problem!


dj_malo
2005-01-07, 00:52
hello! could anyone just make a little script that shows how you can parse out a little line of a html file?

should i begin with downloading the html with this code?

import urllib
sock = urllib.urlopen("http://html.html")
htmlsource = sock.read()
sock.close()
print htmlsource

please! i'm sure i'm not the only one that don't understand this! thank u!

Piscator
2005-01-08, 06:05
the start is ok. parsing html is easy using sgmlparser. this link (http://www.diveintopython.org/html_processing/index.html) is really helpful. also for other python stuff.

greetz,
piscator