I want to add a new row to an existing .csv file in python.
I tried by the following by appending a line to the csv file in spyder IDE in windows.
def write_to_file():
file = open('E:/Python/Sample//Dataset.csv','a')
file.write(",".join([str(newID),request.form['username'],request.form['age']]))
file.close()
I expect the new values in a new row. But it is appending the new values in the last row.
If i add name "Erick" and Age "60", the output looks like the below image.
But I expect something like the below.