Case insensitive dictionary?
Fuzzyman
michael at foord.net
Sun Jun 27 10:34:40 EDT 2004
elbertlev at hotmail.com (Elbert Lev) wrote in message news:<9418be08.0406250921.71f4eba4 at posting.google.com>...
> 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?
I'm probably a bit late on this one... but I've written a complete
case-insensitive dictionary (and list..) with all dictionary methods
implemented....
It's called caseless and available at :
http://www.voidspace.org.uk/atlantibots/pythonutils.html#configobj
I've tested it fairly well as it the base class for my configuration
module ConfigObj.
Regards,
Fuzzy
http://www.voidspace.org.uk/atlantibots/pythonutils.html
More information about the Python-list
mailing list