Re: assign dict by value to list

2005-09-07 Thread Bryan Olson
Phill Atwood wrote: [...] > So how do I add a dictionary into a list by value rather than > by reference? Is rec.items() what you want? It returns a list of (key, value) tuples. > The complete code is here: [...] Looks like you could use Python's ConfigParser module. http://docs.python

Re: assign dict by value to list

2005-09-06 Thread Terry Reedy
"Phill Atwood" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > def csv_it(): > db = [] # the entire database of records > rec = {} # a single rec: a dictionary of field names and data pairs Move this line > fields = [] # list of field names collected so far for curren

Re: assign dict by value to list

2005-09-06 Thread Steve Holden
Phill Atwood wrote: > Newbie question: > > I have a dictionary called "rec". And a list called "db". db is my > database. rec are to be records in the database. In a loop I'm trying to > create a record and add it to my database. The key stmt is > > db.append( rec ) > > This works initially

assign dict by value to list

2005-09-06 Thread Phill Atwood
Newbie question: I have a dictionary called "rec". And a list called "db". db is my database. rec are to be records in the database. In a loop I'm trying to create a record and add it to my database. The key stmt is db.append( rec ) This works initially but it seems that instead of copying