def reademail():
f = open("Y11email.csv", "r")
line= "email"+ ","+"fname"+","+"sname"+"password"+"\n"
for line in f:
email,fname,sname,password=line.split(", ")#splits each line however creates an extra space between the lines because of enter
password=password.strip()#strip removes the extra space between the lines
print(email,fname,sname,password)
f.close()
I am new to python so I don't understand the Error I keep getting. I hope someone can explain. If you need any more information I'll edit it in.
email,fname,sname,password=line.split(", ")#splits each line however creates an extra space between the lines because of enter
ValueError: not enough values to unpack (expected 4, got 1)
I want it print like this:
email@abc.org.uk Name Surname fakepassword
check@email.org.uk Z Y fakepassword
testing@the.program Ray Check hello
Edit: I've tried to remove the space between after the comma and tried to .split("\n") but got
email,fname,sname,password=line.split("\n")#splits each line however creates an extra space between the lines because of enter
ValueError: not enough values to unpack (expected 4, got 2)
At least I got one more value XD