Jul-05-2018, 10:39 AM
I am trying to read data from a file called census2010.py containing data in the following format(snippet of the full data):
T
allData = {'AK': {'Aleutians East': {'pop': 3141, 'tracts': 1}, 'Aleutians West': {'pop': 5561, 'tracts': 2}, 'Anchorage': {'pop': 291826, 'tracts': 55}, 'Bethel': {'pop': 17013, 'tracts': 3}, 'Bristol Bay': {'pop': 997, 'tracts': 1}, 'Denali': {'pop': 1826, 'tracts': 1}, 'Dillingham': {'pop': 4847, 'tracts': 2}, 'Fairbanks North Star': {'pop': 97581, 'tracts': 19}, 'Haines': {'pop': 2508, 'tracts': 1}, 'Hoonah-Angoon': {'pop': 2150, 'tracts': 2}, 'Juneau': {'pop': 31275, 'tracts': 6},etc etcWhen I try to do the following in the python shell:
>>>import census2010 >>>census2010['AK']['Anchorage']I get the following error;
T
Error:raceback (most recent call last):
File "<input>", line 1, in <module>
TypeError: 'module' object is not subscriptable