Using Command Line Arguments in Python | Part 2 - getopt library

preview_player
Показать описание
In this video, we are going to continue where we left and demonstrate the username and password verification using command line in python with the help of getopt library which provides options as a way to accept command line arguments.

Jump directly to the code part if you want to have a quick look -
0:30 - 5:53 - boilerplate code
7:55 - 12:12 - final finished code

If you find the video useful please share your views on it in the comment section, also do share it with your friends and click on subscribe and stay tuned for more content like this. Peace!
Рекомендации по теме
Комментарии
Автор

Aapne to ek hi baar me sikha Diya .... thank you very much

shaktikumar
Автор

Is it possible to pass a string to getopt outside of the command-line?

For example, these don't work, presumably because they are not an array of arrays?
options, arguments = getopt.getopt("TestOnly -e -w -v", "hqVeuwvrsnRBP:p:b:a:l:g:f:", ["help", "version"])
options, arguments = getopt.getopt("-e -w -v", "hqVeuwvrsnRBP:p:b:a:l:g:f:", ["help", "version"])

How could a string be converted to be recognized by getopt?

bennguyen
welcome to shbcf.ru