Is there any way to say ignore case with "in"?
Steve Holden
steve at holdenweb.com
Sat Apr 5 07:14:56 EDT 2008
7stud wrote:
> On Apr 4, 2:43 pm, tinn... at isbd.co.uk wrote:
>> Is there any way in python to say
>>
>> if string1 in string2:
>> <do something>
>>
>> ignoring the case of string1 and string2?
>>
>> I know I could use:-
>>
>> if lower(string1) in lower(string2):
>> <do something>
>>
>> but it somehow feels there ought to be an easier (tidier?) way.
>>
>
> Easier? You mean like some kind of mind meld?
>
That's right, DWIM mode Python. Rock on!
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
More information about the Python-list
mailing list