I have a simple (but huge) CSV table, and I need to insert a free (=blank) line/row after each line/row of this table. To explain it in another way, I want every second line of my table to be blank (but without deleting/overwriting any of the original lines). I have tried a lot of ways, but this is the best I could come up with:
with open(sys.argv[1], 'r') as input:
readie=csv.reader(input, delimiter=',')
with open("output.csv", 'wt', newline='') as output:
outwriter=csv.writer(output, delimiter=',')
for row in readie:
row_plus = (row, \n)
outwriter.writerow(row_plus)
It doesn’t seem to work because it crams all the columns in the table into one column and interprets (row, \n) as two columns only. It also just prints “\n” and doesn’t recognize that I want it to insert another line break.
How about:
Seems to do what you want.