regular expression: perl ==> python

JZ wnebfynj at mnovryyb.pbz
Wed Dec 22 11:12:55 EST 2004


Dnia Wed, 22 Dec 2004 16:55:55 +0100, Fredrik Lundh napisał(a):

> the "_" symbol has no special meaning when you run a Python program, 

That's right. So the final code will be:

import re
line = "The food is under the bar in the barn."
found = re.search('foo(.*)bar',line)
if found:  print 'got %s\n' % found.group(1)

-- 
JZ ICQ:6712522
http://zabiello.com  



More information about the Python-list mailing list