Windows系统编写python第一行:#!python3
#! python3 # pw.py -一个口令保管箱 PASSWORDS={'email':'F7minlBDDuvMJuxESSKHFhTxFtjVB6', 'blog':'WmALvQyKAxiVH5G8v01if1MLZF3sdt', 'luggage':'12345'} import sys,pyperclip if len(sys.argv)<2: print('用法:python pw.py xxxxx(字典的键)---------复制账户密码') sys.exit() account=sys.argv[1] #第一个传入数据 if account in PASSWORDS: pyperclip.copy(PASSWORDS[account]) #剪贴板拷贝内容 print('Password for '+account+' copied to clipboard.') else: print('There is no account named '+account)
#于cmd具体操作图:
#代码如下:
C:\Users\12345>d: #切盘
D:\>cd MyPythonScripts #直到切到.py文件所在的文件夹
D:\MyPythonScripts>python pw.py #未输入键
用法:python pw.py xxxxx(字典的键)---------复制账户密码
D:\MyPythonScripts>python pw.py zhang #输入不存在键
There is no account named zhang
D:\MyPythonScripts>python pw.py luggage #输入存在键‘luggage’
Password for luggage copied to clipboard. #拷贝成功
12345 #代码运行成功,剪贴板内容被替换为‘luggage’值
D:\MyPythonScripts>python pw.py email #输入存在键‘email’
Password for email copied to clipboard. #拷贝成功
F7minlBDDuvMJuxESSKHFhTxFtjVB6SS #代码运行成功,剪贴板内容被替换为‘email’值
标签:MyPythonScripts,pw,luggage,python,py,口令,保管箱,email From: https://www.cnblogs.com/lucass/p/17131430.html