Comparing a string

Bjorn Pettersen bjorn at roguewave.com
Tue Jul 11 15:28:57 EDT 2000


import string

if string.lower("FOO") == string.lower("Foo"):
   <do something useful>

-- bjorn

johnvert at my-deja.com wrote:
> 
> Hi,
> 
> How can I compare two strings in a case-insensetive way? I couldn't find
> a function similar to strcasecmp or even to strcmp in
> http://www.python.org/doc/current/lib/module-string.html.  I understand
> it's a silly question, but I can't find a way to do this (I don't want
> to use regexps)
> 
> Thanks,
> -- John
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy.
> --
> http://www.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list