Searching a large dictionary

mike171562 support.desk.ipg at gmail.com
Wed Sep 23 21:57:53 CEST 2009


i am trying to search a large Python dictionary for a matching value.
The results would need to be structured into a new dictionary with the
same structure. Thanks.

The structure is like this

{ 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}]
}




On Sep 22, 7:16 pm, Dave Angel <da... at ieee.org> wrote:
> 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.
>
> Thanks.
> DaveA




More information about the Python-list mailing list