Mostly Linux & Python syntax notes and hyperlinks.

Thursday, August 12, 2010

python: iterating through csv.reader record

import csv

myReader=csv.reader(open(file_name,"rb"),delimiter='\t', quoting=csv.QUOTE_NONE) 

for record in myReader:
    print("len(record)="+str(len(record))
    for i in range(len(record)):
        print("record " + str(i) + "=" + record[i])

Though watch for Error Message
"not all arguments converted during string formatting"

No comments:

Post a Comment