Newbie backreference question

Robert Kern rkern at ucsd.edu
Thu Jun 30 23:30:49 CEST 2005


paulm wrote:
> Hi,
> 	In perl I can do something like:
> 
> $a = 'test string';
> $a =~ /test (\w+)/;
> $b = $1;
> print $b . "\n";
> 
> and my output would be "string".
> 
> 	How might this snippet be written in python?

http://docs.python.org/lib/module-re.html

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter




More information about the Python-list mailing list