Matching Strings

John Machin sjmachin at lexicon.net
Fri Feb 9 20:07:46 EST 2007


On Feb 10, 12:01 pm, rshepard-at-appl-ecosys.com wrote:
> On 2007-02-10, James Stroud <jstr... at mbi.ucla.edu> wrote:
>
> > Assuming item is "(u'ground water',)"
>
> > import re
> > item = re.compile(r"\(u'([^']*)',\)").search(item).group(1)
>
> James,
>
>   I solved the problem when some experimentation reminded me that 'item' is
> a list index

AArrgghh it's not a list index, it's a ferschlugginer tuple containing
1 element.




More information about the Python-list mailing list