Ok so now my question is, how would I retrieve dict data from a file, update it to a dict in my program, then write the new username / password recieved to the end (append) of the dict in the file as a key:value pair?
e.g with a list I would retrieve data like so:
e.g with a list I would retrieve data like so:
usrdatalist = [] # Open file to read with open("usrdata", "r") as usrinfo: for l in usrinfo: un, pw = l.split(',') usrdatalist.append([un, pw])and then write the new data after getting the username and password info from user like so:
with open("usrdata", "a") as usrinfo: usrinfo.write(username+','+password+'\n')How would I go about changing this to fit a dict?