口令保管箱程序,用 pyperclip.copy 复制后,粘贴板的内容为空。求解,谢谢!操作系统为 Deepin

#! python3

pw.py - An insecure password locker program.

PASSWORDS = {‘email’: ‘F7minlBDDuvMJuxESSKHFhTxFtjVB6’,
‘blog’: ‘VmALvQyKAxiVH5G8v01if1MLZF3sdt’,
‘luggage’: ‘12345’}

import sys, pyperclip

if len(sys.argv) < 2:
print(‘Usage: python pw.py [account] - copy account password’)
sys.exit()

account = sys.argv[1] # 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 named ‘ + account)

讨论数量: 2
Jason990420

我只有 WIN10, 结果是 OK 的. 可能与作业系统 Deepin 有关.

  • 在 Windows 上,不需要其他模块。
  • 在 Mac 上,此模块使用 os 随附的 pbcopypbpaste 命令。
  • 在 Linux 上,此模块使用 xclipxsel 命令,它们应随 os 一起提供。否则,请运行 sudo apt-get install xclipsudo apt-get install xsel (注意:xsel 似乎并不总是有效); 否则,在 Linux 上,您将需要安装 gtkPyQt4 模块。
3年前 评论

我也一样,你有办法了吗

3年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!