Livin wrote: > I'm a noobie so please be easy on me. I have searched a ton and did not find > anything I could understand. > > I'm using py2.3 > > I've been using Try/Except but this gets long with multiple dictionaries. > > I found some code on web pages and such but cannot get them to work. Any > help is appreciated as I need to search multiple dictionaries for keys. > > > > here's the code I found but cannot get to work... > > dict_set = (self.dictHSdevices, self.dictHSevents, self.dictHSbtnDevices) > <-- /creates set of dictionaries/ > > /code to search the set/--> > > val = [ d for d in dict_set if d[value] in dict_set ] > OR > for key, value in dict.iteritems(): pass
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/305268 http://mail.python.org/pipermail/python-list/2005-August/294519.html (I think these may be a little different from what you're asking above, since they search dicts sequentially and return 1st hit) -- http://mail.python.org/mailman/listinfo/python-list