Code:
def view():
with open("passwords.txt", 'r') as f:
for line in f.readlines():
data = line.rstrip()
user, passw = data.split("|")
print("User:", user, "| Password:", passw)
Error message:
`File "c:\Users\Josh Lee\Python\Hello World\password_manager.py", line 27, in <module>
view()
File "c:\Users\Josh Lee\Python\Hello World\password_manager.py", line 8, in view
user, passw = data.split("|")
ValueError: too many values to unpack (expected 2)
This is my code. I have tried to change line 8, but it’ll say too little expected (expected: 2 got:1) and then it’ll show this. I’ve been stuck on this for a while and would like some pointers on where I can improve the code