Neatest way to do a case insensitive "in"?

MRAB google at mrabarnett.plus.com
Fri Mar 13 22:56:36 CET 2009


tinnews at isbd.co.uk wrote:
> What's the neatest way to do the following in case insensitive fashion:-
> 
>     if stringA in stringB:
>         bla bla bla
> 
> I know I can just do:-
> 
>     if stringA.lower() in stringB.lower():
>         bla bla bla
> 
> But I was wondering if there's a neater/easier way?
> 
Not unless someone writes a patch to add a case-insensitive 'find'
method to str.



More information about the Python-list mailing list