Why I am getting the space after one row and it is moving onto third row, when I write the code to open a CSV file in excel?
I have used the code below.
import csv
with open("self_taught.csv", "w") as csvfile:
spamwriter = csv.writer(csvfile, delimiter=",")
spamwriter.writerow(["one", "two", "three"])
spamwriter.writerow(["four", "five", "six"])
CodePudding user response:
Use newline=""
when open csv by python.
EX:
with open(pathToFile, newline='') as f:
...