Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: case insensitive list ?

0 views
Skip to first unread message

Robert Kern

unread,
Apr 5, 2010, 1:23:10 PM4/5/10
to pytho...@python.org
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

0 new messages