标签:题目 字典 ctr cat count 字符 bre cli value
根据用户输入的序号找到对应的登录名称
将这个登录名称对应的密码自动复制到剪切板中
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,"="))
熟练掌握字典的相关方法的使用:keys() values() items()
熟练掌握字符串相关方法的使用:ljust() rjust() center()
熟练掌握pyperclip.copy() pyperclip.paste()
利用批处理文件来执行这个程序
三少好久没吃火锅啦,已经没有更新的心情啦,所以待更新中......
标签:题目 字典 ctr cat count 字符 bre cli value
原文地址:http://www.cnblogs.com/NeverCtrl-C/p/6130468.html