Help in python project: password locker | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help in python project: password locker

cant understand the second step of project: password locker from chapeter -6 in the book Automate the boring stuff with python.

8th Nov 2016, 8:22 AM
harjeevan singh
harjeevan singh - avatar
4 Answers
+ 3
the print simply output the text, in this case explain how to use the program: python, call for execute the file pw.py, the name of the file [account], optional argument that'll be putted in sys.argv [1] copy account password, if you put an account name it'll copy the password on the clipboard the print statement obviously only print text and does nothing
10th Nov 2016, 3:32 PM
Wombato Wom
Wombato Wom - avatar
+ 1
you add command line argument support, so when you execite your program, for ex: python myfile.py you can add arguments: python myfile.py argument in this case you can enter an account name and you'll get the password for that account so: python myfile.py luggage and you'll get 12345 copied to the clipboard(in the third step the book add codes for copy this to the clipboard, so for now it'll do nothing)
10th Nov 2016, 9:56 AM
Wombato Wom
Wombato Wom - avatar
0
ok...please explain the print argument if len(sys.argv) < 2: print('Usage: python pw.py [account] - copy account password')
10th Nov 2016, 10:17 AM
harjeevan singh
harjeevan singh - avatar
0
thank you
10th Nov 2016, 3:38 PM
harjeevan singh
harjeevan singh - avatar