python - Loop list and open file if found -


not sure start this... know how read in csv file if have heap of files in same directory, how can read them in according whether in list. example, list such as...

l= [['file1.csv','title1','1'], ['file2.csv','title2','1'],['file3.csv','title3','1']] 

how can 3 files though 'file20.csv' in directory. can somehow loop through list , use if-statement check filenames , open file if found?

for filedesc in l: #go on each sublist in l     fname, ftitle, _ = filedesc #unpack information contained in     open(fname) f: #open file appropriate name         reader = csv.reader(f) #create reader of file         #go bussiness 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -