appending certain columns in a csv file to another file does not remove each row

either use a csv.writer and use .writerow or write newline characters. One option is to use print with the file= option:

# replace this
# fh.write(','.join(tmp_row))
# with any of these:
print(*tmp_row, sep=",", file=fh) # default is end="\n" so you get rows
fh.write(','.join(tmp_row) + '\n')

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top