Dnia 21 Dec 2004 21:12:09 -0800, [EMAIL PROTECTED] napisał(a): > 1) In perl: > $line = "The food is under the bar in the barn."; > if ( $line =~ /foo(.*)bar/ ) { print "got <$1>\n"; } > > in python, I don't know how I can do this? > How does one capture the $1? (I know it is \1 but it is still not clear > how I can simply print it. > thanks
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) -- JZ ICQ:6712522 http://zabiello.om -- http://mail.python.org/mailman/listinfo/python-list