I am currently creating a signup and login page for an application but whenever I create a new username/password combo, I see it in my list right after creating it (I print the dictionary at the end of the program so I can see it) but after I decide to rerun the code, the usernames and passwords that I just created are gone. How do I get these to stay even after rerunning the code?
I do not know if adding my code will help here (I do not think that it will) but I will add the bits that I feel could potentially be the most helpful:
import re
usernames_passwords = {'lmaoidontknow': 'password123',
'evillover456': 'waterworld332',
'xyzitsme': 'notmypass',
'unicornpops': 'blahbleh76'}
while not chosen_user:
chosen_user = input("""Enter the username that you would like. Please keep it between 6 and 15
characters. Do not use special characters such as '&', '@', or '!' in your username. Underscores are
allowed.\n>""")
if (6 <= len(chosen_user) <= 15) and re.search(r"^[a-zA-Z0-9_]+$", chosen_user):
print('')
else:
print('Username does not meet the requirements. Please try again.')
chosen_user = False
if chosen_user in input_usernames:
print('This username is already taken. PLease try again.')
chosen_user = False
The dictionary at the top was created just to test certain things such as making sure usernames were not replicated and they are not permanent. Whenever I rerun my code, that dictionary is the only usernames/passwords that remain and I want all usernames and passwords that I input to stay.
Edit: This is only the username code. Password code can be included if asked for but I do not think it will make much of a difference.