I need to scan for second item in code to check its correct but comes back with this error:
Traceback (most recent call last):
File "C:/Users/oscar/Documents/ff.py", line 29, in <module>
with open(account) as f:
TypeError: expected str, bytes or os.PathLike object, not list
The code:
step = str(input("do you have an account? (reply with yes or no)"))
if step == ("no"):
username = input("what do you want your username to be?")
password = input("what do you want your password to be?")
favgenre = input("what is your favourite genre?")
favartist = input("who is your favourite artist?")
account = open("%s.txt" %username, "w+")
account.write(username)
account.write(",")
account.write(password)
account.write(",")
account.write(favgenre)
account.write(",")
account.write(favartist)
account.write(",")
account.close()
if step == ("yes"):
username = input("please enter username")
password = input("please enter your password")
account = open("%s.txt" %username, "a+")
account = [account]
filename = (username)
if username == username:
with open(account) as f:
strings = f.readlines()
data = [string.split() for string in strings]
print(data[1])