(newbie) Array of dictionaries

Janko Hauser hauser at ifm.uni-kiel.de
Sat Oct 2 05:16:35 EDT 1999


Perhaps I do not understand right, or you have a syntax problem in
your tests.

>>> a=[]
>>> a.append({'key1':'hello','key2':' world'})
>>> a.append({'key1':'another ','key2':'world'})
>>> a[0]['key1']
'hello'
>>> a[1]['key1']
'another '
>>> 

So this looks equivilant to 'dict[n][<key>]', but is this what you
want?

HTH

__Janko
-- 
  Institut fuer Meereskunde             phone: 49-431-597 3989
  Dept. Theoretical Oceanography        fax  : 49-431-565876
  Duesternbrooker Weg 20                email: jhauser at ifm.uni-kiel.de
  24105 Kiel, Germany




More information about the Python-list mailing list