"Topic Requirements
Find the corresponding login name based on the number entered by the user
Automatically copy the password corresponding to this login name to the Clipboard
"Program implementation
1 #!/usr/bin/env python2 ImportPyperclip3Information = {4 "wifi Password":"1",5 "Blog Park Login name":"2",6 }7 8Information01 = {9 "1":"wifi Password",Ten "2":"Blog Park Login name", One } A -passwords = { - "1":"39322438", the "2":"Neverctrl_c", - } - -PASSWORDS01 = { + "wifi Password":"39322438", - "Blog Park Login name":"Neverctrl_c", + } A at whileTrue: - Print("notice:the Word of name is represent all of the account name.") - Print("Please input the account name (\ "\": Quit):") -Account =input () - if ""==Account : - Break in if "name"==Account : - forKvinchInformation.items (): to Print(K.ljust (20,".") + V.rjust (5,".")) + if "Password"==Account : - forKvinchPasswords01.items (): the Print(K.ljust (10,".") + V.rjust (20,".")) * ifAccountinchpasswords: $ pyperclip.copy (Passwords[account])Panax Notoginseng Print("The content of"+ information01.get (account,"haha") +"Have been copied to clipboard") - Else: the Print("There is no content about"+Account ) + Print("GO on". Center (60,"="))
View CodeThe purpose of the procedure
Proficiency in the use of dictionary related methods: keys () VALUES () items ()
Proficiency in the use of string-related methods: Ljust () rjust () center ()
Master pyperclip.copy () Pyperclip.paste ()
"Program Improvement
Use a batch file to execute this program
Three less for a long time did not eat hot pot, has no updated mood, so update in ...
Password Safe deposit box