[Tutor] CSV Ouptut concern...
delegbede at dudupay.com
Thu Mar 17 12:56:43 CET 2011
i wrote a code for extracting information from a csv file into another csv
it worked well but i have an immediate challenge i can't seem to fix.
the new file that is created has an row and then an empty row and then a row
all through the file. how can i make the empty rows not be part of the file.
here is the code:
reader = csv.reader(open('stateparty.csv'))
counter = 1
fh = open('stateparty2.csv','w')
writer = csv.writer(fh)
for row in reader:
if counter == 1:
parties_row = row
elif counter > 2:
for index, column in enumerate(row[1:-1]):
if column == "1":
counter += 1
and the output has something like this:
i am not expecting the spaces in between each line, kindly help with the
Elegbede Muhammed Oladipupo
Mobile Banking Solutions | Transaction Processing | Enterprise Application
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor