在win10中,通过CMD运行如下python程序
#! python3
PASSWORDS={'email' : 'fkfjoifjfjsf',
'blog' : 'fiefhdufho',
'luggage' : '243442'}
import sys,pyperclip
if len(sys.argv)<2:
print('usage: python pw.py [account] - copy account password')
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 names' + account)
其中pyperclip.copy(PASSWORDS[account])可以正常执行,但print('Password for' + account + 'copied to clipboard.')中的字符不能正常显示,测试else后面的print,也不能执行。也就是说其它代码都能正常执行,但print不能执行。哪位同志能够帮忙解决一下。
PASSWORDS={'email' : 'fkfjoifjfjsf',
'blog' : 'fiefhdufho',
'luggage' : '243442'}
import sys,pyperclip
if len(sys.argv)<2:
print('usage: python pw.py [account] - copy account password')
sys.exit()
account=sys.argv[1]
if account in PASSWORDS:
password_string=PASSWORDS[account].encode('utf-8')
pyperclip.copy(password_string)
print('Password for' + account + 'copied to clipboard.')
else:
print('there is no account names' + account)