Hi! I have a group of files in a directory. I want to extract from files whose names start with bb_ column number 5 to an excel file. I have 6 bb_ files, therefore I want to get 6 columns (5th column from each file) This code is working,with the following errors:
I get the data in only one column, instead of six I get white cell after every extracted cell I've got help from http://mail.python.org/pipermail/tutor/2004-November/033474.html, though it is not working for me This is my code: import os import fnmatch import csv path = '//......' files=os.listdir(path) csv_out=csv.writer(open('out.csv', 'w'), delimiter=' ') for infile in files: if fnmatch.fnmatch(infile, 'bb_*'): print infile filename= path+infile print filename f=open(filename) for line in f.readlines(): b=line.split('\t') csv_out.writerow(b[5]) f.close
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor