Saturday, September 09, 2006

python re cheatsheet


import re

myRE = re.compile("(http.*\.gif)")

text = """
...
"""

for w in text.split():
m = myRE.search(w)
if m:
print '''"%s",''' % m.string[m.start():m.end()]



No comments: