Dictionary problem

Elena Schulz elena.schulz at gmx.net
Mon Nov 17 19:21:45 CET 2003


Hi,  Antonmuhin, Alex and Batista,

as I can use only Python 2.1 dict() is not allowed I guess.
The .copy() trick works on the simple example I gave. Thanks a lot for your
hints.

But my real problem is more complex (nested dicts) like this:

p_settings = {}
for item in items :
   p = myList # a list
   for i in range(10) :
      for setting in p[i] :
          p_settings['anotherString']['aString'] = myString
   object_dict = {'id':'anotherString', 'settings':p_settings}
   object_perms_list.append(object_dict)

here the copy()-trick does not work. How would you solve that?

-- Thanks for your help, Elena






More information about the Python-list mailing list