case insensitive list ?
Robert Kern
robert.kern at gmail.com
Mon Apr 5 13:23:10 EDT 2010
On 2010-04-05 12:17 PM, Stef Mientki wrote:
> hello,
>
> AFAIK there's no case insensitive list in Python.
> By case insentive I mean that that sort and memebr of is case insensitive.
>
> Does soeone has a implementation of sucha case insensitive list ?
mylist.sort(key=lambda x: x.lower())
any(x.lower() == lowercase_query for x in mylist)
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list
mailing list