CSV Reader
Mike P
michael.pearmain at tangozebra.com
Mon Feb 11 11:09:57 EST 2008
Hi Larry,
i'm still getting to grips with python, but rest assured i thinkn it's
better for me to write hte code for learnign purposes
My basic file is here, it comes up with a syntax error on the
startswith line, is this because it is potentially a list?
My idea was to get the lines number where i can see Transaction ID and
then write out everything from this point into a new datafile.
Would a better solution be just to use readlines and search for the
string with a counter and then write out a file from there?
Any help is greatly appreciated
Mike
working_CSV = "//filer/common/technical/Research/E2C/Template_CSV/
DFAExposureToConversionQueryTool.csv"
import csv
f = file(working_CSV, 'rb')
reader = csv.reader(f)
CSV_lines = ""
for data in reader:
if lines.startswith("Transaction ID")
append.reader.line_num()
# there will only be 1 instance of this title at the start of the CSV
file
writer(Working_csv.csv[, dialect='excel'][, fmtparam])
More information about the Python-list
mailing list