I have numerous dictionaries. I have their names stored in a list (as strings). How can I programmatically access a specific dictionary using a name stored as a string?
>>> dict1 = dict([('key1',1), ('key',2), ('key3',3)])
>>> dict1.keys()
dict_keys(['key2', 'key1', 'key3'])
>>> dictname = 'dict1'
>>> dictname.keys()
AttributeError: 'str' object has no attribute 'keys'
I understand why this doesn't work, but can it be done some other way?