I made a program which stores, updates, removes passwords for different accounts. However, although the program runs smoothly, whenever I restart the program, the PASSWORDS dictionary gets reset to the value in the program. Is there a way to update the dictionary every time I use the program from Windows CMD?
from sys import *
from pyperclip import *
if argv[1] == 'CamelCase':
print('Entering program')
else:
print('Enter correct password for program')
exit()
PASSWORDS = {'email': 'F7minlBDDuvMJuxESSKHFhTxFtjVB6',
'blog': 'VmALvQyKAxiVH5G8v01if1MLZF3sdt',
'luggage': '12345'}
if len(argv) < 2:
print('No account named')
exit()
action = argv[2]
account = argv[3]
if len(argv) == 5:
password = argv[4]
else:
pass
if action == 'check':
if account in PASSWORDS:
print('The account exists.\nDo you want the password.\nEnter y / n')
response = input()
if response == 'y':
copy(PASSWORDS[account])
print('Password for ' + account + ' copied to clipboard.')
exit()
elif response == 'n':
print('Closing the program')
exit()
else:
print('Closing program due to invalid response')
exit()
if action == 'copy':
copy(PASSWORDS[account])
print('Password for ' + account + ' copied to clipboard.')
exit()
elif action == 'add':
PASSWORDS[account] = password
print('Password for ' + account + ' has been added')
exit()
elif action == 'remove':
PASSWORDS.pop(account)
print('Password for ' + account + ' has been removed')
exit()
elif action == 'update':
PASSWORDS[account] = password
print('Password for ' + account + ' has been updated')
exit()