Searching a large dictionary

Dave Angel davea at
Wed Sep 23 02:16:24 CEST 2009

Support Desk wrote:
> I need help searching a large python dictionary. The dictionary is setup
> like so
> Key[{'item':value,'item2':value,'item3':value,'item4':value,'item5':value','item6':value,'item7':value,'item8':value,'item9':value}]
> Key2[{'item':value,'item2':value,'item3':value,'item4':value,'item5':value','item6':value,'item7':value,'item8':value,'item9':value}]
> Key3[{'item':value,'item2':value,'item3':value,'item4':value,'item5':value','item6':value,'item7':value,'item8':value,'item9':value}]
> What would be the best way to search for a specific value of item1 and add
> all the results to a new dictionary? Thanks
With all the messages I've seen so far on this thread, all you've 
managed to do is confuse it further.   I suggest you start over (new 
thread) with a legal program defining a single dictionary (with real 
values for Key, Key2, and value, and without extra quote marks which 
make it fail to compile even if we guess what you're doing with the 
three keys).  I suggest that at least some relevant parts of the data 
should not be all identical, so we can tell what's important.

Use copy & paste from working code.

Then given a real dictionary, describe what you really want to search 
for, and what acceptable results would be.

And also specify the programming language, version, and OS environment.


More information about the Python-list mailing list