PDA

View Full Version : Python grep like for urllib



ard1an
November 17th, 2010, 11:40 PM
Hi, I need something like grep for a python script


import urllib
f = urllib.urlopen("http://www.ubuntu.com")
print f.read()

So I need to search for specific string, how do I do that ive got some suggestion to use lxml.html dunno how to use it.

Vaphell
November 18th, 2010, 12:58 AM
what about re.search()?

http://docs.python.org/library/re.html