I am a beginner in Python and therefore am not sure why I am receiving the following error:
TypeError: invalid file: []
for this line of code:
usernamelist=open(user_names,'w')
I am trying to get an input of a username and password, write them to files, and then read them.
Here is the rest of my code:
user_names=[]
passwords=[]
username=input('Please enter a username')
password=input('Please enter a password')
usernamelist=open(user_names,'w')
pickle.dump(userName,usernamelist)
usernamelist.close()
usernamelist=open(user_names,'r')
loadusernames=pickle.load(usernamelist)
passwordlist=open(passwords,'w')
pickle.dump(password,passwordlist)
passwordlist.close()
passwordlist=open(passwords,'r')
loadpasswords=pickle.load(passwordlist)
All answers would be appreciated. Thanks.