Use Command-line Interface (CLI) Arguments via Python's sys.argv to Write Flexible Terminal Scripts

preview_player
Показать описание
0:00 Example Setup in VSCode
2:30 Demonstration with Python module being run with many arguments
6:10 Quoting in multi-word arguments
8:01 Overview of Tutorial for "Searching" a file for a specific search term a la simplified grep
8:50 Boilerplate main function and if __name__ idiom established
10:34 Establishing a read_args function to check for valid CLI arguments and return dictionary
12:35 Checking for a valid number of command-line arguments and printing helpful usage information
19:35 Establishing a function skeleton to search a file for all lines containing some word
22:49 Extending the main function to contain the overarching steps of the program
Рекомендации по теме
Комментарии
Автор

You teach with crystal clarity. It’s so funny how a topic can be either obscured or made easily digestible

intalek_
Автор

I have now one year of dealing with Python, yet I learned many things during this video that I just discovered!
Love it.
Thank you ver much Kris Jordan.

programmingchannel
Автор

Seems like I just found the kind of teacher I always wanted ❤️

r_Official
Автор

This is so much information, and free... thank you so much Kris! Subscribed!

marcovalentinoalvarado
Автор

I liked the video because the way you explained everything was awesome, i didn't understand from the videos but in this one, i give it 5 stars [ 🌟 🌟 🌟 🌟 🌟 ]

developershub
Автор

Great channel, excellent videos. Thank you Kris Jordan.🙏🙏🙏

heminsatya
Автор

You're a great teacher, everything very well explained!

iluvsyphonfilter
Автор

very good presentation... inspired me to find a way to highlight the keyword; in the search_file() method I replaced 'matches.append(line)' with 'matches.append(line.replace(keyword, "\33[33m"+keyword+"\33[0m", -1))'. this only works for a dark themed scenario. I appreciate the use of the standard library; other YouTubers have made use of 'click' and 'argparse' and I need to learn those too, but this was educational.

techgoat
Автор

Top notch content.
Exactly what i needed, thank you!

DaviMartins
Автор

Could you please tell how to add this $ sign in the terminal; I do not have such

ДианаСоветова-гй
Автор

Very clear instructions! Keep it up with more videos! Where can I find your awesome code that your are writing here so that I can use them as template?

SureshKumar
Автор

Thank you, very helpful! Subscribed. - Just one request. Can you upload a link to the source? I've followed along, but ran into an issue and my code looks identical to yours. Obviously it's not.

MichaelBacaArtist
Автор

What if I don't want my program to search for keywords, I just want it to see if the file exists from whoever loads up their python command line?

Totally confused. Any help appreciated.

rf
Автор

I liked the video because the way you explained everything was awesome, i didn't understand from the videos but in this one, i give it 5 stars [ 🌟 🌟 🌟 🌟 🌟 ]

developershub