Re: Matching Strings

2007-02-09 Thread rshepard-at-appl-ecosys . com
On 2007-02-10, [EMAIL PROTECTED] wrote:

>   if item == selName:

  Slicing doesn't seem to do anything -- if I've done it correctly. I
changed the above to read,

if item[2:-2] == selName:

but the output's the same.

Rich
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Matching Strings

2007-02-09 Thread rshepard-at-appl-ecosys . com
On 2007-02-10, James Stroud <[EMAIL PROTECTED]> 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 and not a string variable. by changing the line to,

if item[0] == selName:

I get the matchs correctly.

  Now I need to extract the proper matching strings from the list of tuples,
and I'm working on that.

Many thanks,

Rich
-- 
http://mail.python.org/mailman/listinfo/python-list