On Thu, Jan 16, 2014 at 8:41 PM, Sam <lightai...@gmail.com> wrote: > I would like to build an array of dictionaries. Most of the dictionary > example on the net are for single dictionary. > > dict = {'a':'a','b':'b','c':'c'} > dict2 = {'a':'a','b':'b','c':'c'} > dict3 = {'a':'a','b':'b','c':'c'} > > arr = (dict,dict2,dict3) > > What is the syntax to access the value of dict3->'a'?
Technically, that's a tuple of dictionaries, and you may want to use a list instead: lst = [dict, dict2, dict3] Like any other list or tuple, you can reference them by their indices: lst[2] is dict3 lst[2]['a'] is dict3['a'] Hope that helps! ChrisA -- https://mail.python.org/mailman/listinfo/python-list