regular expression: perl ==> python
Doug Holton
insert at spam.here
Wed Dec 22 10:20:37 EST 2004
Fredrik Lundh wrote:
> "JZ" <wnebfynj at mnovryyb.pbz> wrote:
>
>
>>import re
>>line = "The food is under the bar in the barn."
>>if re.search(r'foo(.*)bar',line):
>> print 'got %s\n' % _.group(1)
>
>
> Traceback (most recent call last):
> File "jz.py", line 4, in ?
> print 'got %s\n' % _.group(1)
> NameError: name '_' is not defined
He was using the python interactive prompt, which I suspect you already
knew.
More information about the Python-list
mailing list