Case insensitive dictionary?

Pierre-Frédéric Caillaud peufeu at free.fr
Fri Jun 25 20:04:53 CEST 2004


	Be careful about what character encoding and locale you use, as lower()  
won't process accented characters correctly if the encoding is wrong.


On 25 Jun 2004 10:21:21 -0700, Elbert Lev <elbertlev at hotmail.com> wrote:

> Hi!
>
> Here is the problem:
>
> I have a dictionary. Keys are strings. How to make dictionary  lookup
> case insensitive?
>
> In other words:
> If dict = {'First":"Bob", "Last":"Tom"}, dict["first"] should return
> "Bob"
>
> Maybe dictionary is not the right data type? If so what is?



-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/



More information about the Python-list mailing list