Feb-15-2020, 08:13 PM
I am going though Automate the boring stuff with Python and in a section manipulating strings, there is this script:
# this program is an insecure password locker PASSWORDS = {'email': 'incospmei#$%', 'blog': 'hycnopL%(', 'luggage': '12345'} import sys, pyperclip if len(sys.argv) < 2: print('Usage: python password.py [account] - copy account password') sys.exit() account = sys.argv[2] # first command line arg is the account name if account in PASSWORDS: pyperclip.copy(PASSWORDS[account]) print('Password for ' + account + ' copied to clipboard.') else: print('There is no account name ' + account + '.')My question is, how does the program know that I want the key returned from the variable account? How could I use the key and return the value?