I'm kind of new to python here's my code so far. The goal I want to accomplish is to refer a variable name using another variable.
tax_files=['2008','2009','2011','2012','2013','2014','2015']
file_dir='/'
for tax_file in tax_files:
filename=file_dir + tax_file+'.csv'
with open(filename,'r') as f:
for line in f:
splitted_line = line.split()
dict_(tax_file)[splitLine[1]] = splitLine[0]
in the last line here, dict(tax_file) is suppose to be different at different iteration eg. first iteration should be dict_2008, then dict_2009 and so forth.
just for easier understanding, the file i read in is like this
usgaap costofgoodsold
usgaap returnonasset
Can I accomplish this in python?