The following code allows me to add only 2 sets of data to the csv file. The second bit of code continually overwrites the last 3 entries that I make. Please can anyone help me with this problem, all I wish to do is to add multiple entries without anything being overwritten?
I have copied the code below;
I have copied the code below;
import csv with open('users2.csv','a') as f:# 'a' will add to the existing csv file. #f.write()#f.write('user,pword,day') x=input("User name? ") y=input("Password? ") z=input("Day? ") with open('users2.csv','a',newline='') as f: writer=open('users2.csv') writer=csv.writer(f) writer.writerow([]) writer.writerow([x,y,z]) response=input("Would you like another entry; Yes or No? ") while response == 'Yes': a=input("User name? ") b=input("Password? ") c=input("Day? ") response=input("Would you like another entry; Yes or No? ") else: response=input("Return to end...") with open('users2.csv','a') as f: writer=csv.writer(f) writer.writerow([a,b,c])