I see some unsolved related questions, so... here I am to toss a coin and see if anyone can help me!
I´m using the CSV module to create csv files, but for each created line, the code adds one blank line.
The csv module has 2 ways to write a csv file: list mode and ordered dict mode. Both create the same problem.
I pasted here a "list mode" code.
from csv import writer
with open('movies.csv', 'w') as file:
writer_csv = writer(file)
movie = None
writer_csv.writerow(['Title', 'Genre', 'Lenght'])
while movie != 'finish':
movie = input('Movie name: ')
if movie != 'finish':
genre = input('Genre: ')
lenght = input('Lenght: ')
writer_csv.writerow([movie, genre, lenght])
Everything works fine, but the extra blank line.
The result is...
Title,Genre,Lenght
Bourne Identity,Action,120
Bourne Supremacy,Action,125
Ultimatum Bourne,Action,128
And the desired result is...
Title,Genre,Lenght
Bourne Identity,Action,120
Bourne Supremacy,Action,125
Ultimatum Bourne,Action,128
Thank's for any help!