》题目要求

  根据用户输入的序号找到对应的登录名称

  将这个登录名称对应的密码自动复制到剪切板中

》程序实现

 1 #!/usr/bin/env python
 2 import pyperclip
 3 information = {
 4     "wifi密码":"1",
 5     "博客园登录名": "2",
 6 }
 7 
 8 information01 = {
 9     "1":"wifi密码",
10     "2":"博客园登录名",
11 }
12 
13 PASSWORDS = {
14     "1":"39322438",
15     "2": "NeverCtrl_C",
16 }
17 
18 PASSWORDS01 = {
19     "wifi密码":"39322438",
20     "博客园登录名": "NeverCtrl_C",
21 }
22 
23 while True:
24     print("NOTICE: The word of name will represent all of account name.")
25     print("Please input the account name(\"\" : quit ):")
26     account = input()
27     if "" == account:
28         break
29     if "name" == account:
30         for k, v in information.items():
31             print(k.ljust(20, ".") + v.rjust(5, "."))
32     if "password" == account:
33         for k, v in PASSWORDS01.items():
34             print(k.ljust(10, ".") + v.rjust(20, "."))
35     if account in PASSWORDS:
36         pyperclip.copy(PASSWORDS[account])
37         print("The content of " + information01.get(account, "哈哈") + " has been copied to clipboard")
38     else:
39         print("There is no content about " + account)
40         print("GO ON".center(60,"="))
View Code

相关文章:

  • 2021-09-19
  • 2022-02-14
  • 2021-07-20
  • 2021-12-05
  • 2021-12-08
  • 2021-12-09
猜你喜欢
  • 2021-07-17
  • 2022-12-23
  • 2022-12-23
  • 2021-12-15
  • 2021-06-14
  • 2021-11-03
  • 2021-07-13
相关资源
相似解决方案