I'd like to do something like this; iterate through a file which
consists of data stored in dictionary format, one dict on each line,
and read each line into a new dict using one of the values in the dict
as its name...

for example:

stuff = open('data.txt')
 for eachLine in stuff:
  name{}
   name = eachLine
....and then do something clever to extract the value of the key
(name) from the line and use it as the dictionary's name.

A line from data.txt would look like this: {'name' : Bob, 'species' :
Humboldt, 'colour' : red, 'habits' : predatory}. Aim is to call one of
them by name, and merge the values in that dictionary into a string
pulled from another source.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to