I'm having a problem with lists. Their are 4 list, each with a specific name:
a=[]
b=[]
c=[]
d=[]
Now I want to store values from a whole bunch of xls files in these lists. All these xls files have a name corresponding with the list. For example:
1-2013_a.xls
1-2014_b.xls
I iterate through these files with the following code:
rootdir='C:\users\desktop\folder'
for subdir, dirs, files in os.walk(rootdir):
for file in files:
....
Here i want to append date from the xls file to the list with the same letter as in the name of the file. I could do it like this:
rootdir='C:\users\desktop\folder'
for subdir, dirs, files in os.walk(rootdir):
for file in files:
if(file[7]=='a'):
....
if(file[7]=='b'):
....
if(file[7]=='c'):
....
if(file[7]=='d'):
....
But in my program i have 20 lists, so 20 times an if-condition is a bit odd. Is it possible to call a list by a string without using a dictionary ?
Thanks for helping me in advance