Matching Strings

Larry Bates larry.bates at websafe.com
Fri Feb 9 19:58:32 EST 2007


rshepard-at-appl-ecosys.com wrote:
> On 2007-02-10, rshepard at nospam.appl-ecosys.com 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

Use the interpreter to test things:

a="(u'ground water',)"

a[2:-2]
"'ground water'"

a[3:-3]
'ground water'

That is what you are looking for.

-Larry



More information about the Python-list mailing list