monkeys paw wrote:
I want to store data in a file like show below. Then
i want to import the data in, but am having trouble.
I'm trying:
import sfdata
for x in author_list:
print x
Either
import sfdata
for x in sfdata.author_list: # Access list as an attribute of
the module
print x
or
from sfdata import author_list # Import individual attribute from
module.
for x in author_list:
print x
Gary Herron
FILE: sfdata.py (i'm trying to import it)
==============
author_list = {
'829337' : {
'author_name' : 'Carter, John',
'count' : 49,
'c2' : '0.102040816326531',
'author_party' : 'R',
'f1' : '0.102040816326531',
'f2' : '0.102040816326531',
'author_entry_name' : 'Carter',
'c1' : '0.122448979591837'
},
'825522' : {
'author_name' : 'Stark, Fortney',
'count' : 171,
'c2' : '0.0116959064327485',
'author_party' : 'D',
'f1' : '0.0233918128654971',
'f2' : '0.0116959064327485',
'author_entry_name' : 'Stark',
'c1' : '0.0233918128654971'
},
}
--
http://mail.python.org/mailman/listinfo/python-list