Python Tutorial – 25. Command line argument processing using argparse

Python

Video is ready, Click Here to View ×


This tutorial shows how to pass command line arguments to python script.
Code used in this tutorial: https://github.com/codebasics/py/blob/master/Modules/argparse_tutorial.py
Website: http://codebasicshub.com/
Facebook: https://www.facebook.com/codebasicshub
Twitter: https://twitter.com/codebasicshub
Google +: https://plus.google.com/106698781833798756600 Patreon: https://www.patreon.com/codebasics

38 thoughts on “Python Tutorial – 25. Command line argument processing using argparse

  1. I've upvoted every of your videos I've had the pleasure of viewing. If you don't know already, you have to turn up the volume to hear the videos on YouTube. The problem arises when your video finishes and YouTube plays an ad, which comes in way too loud.

  2. Thanks for this video. Could you explain what is the difference between -number1 and –number1 in optparse module and also what is the use of dest and callback in that module.

  3. Distracting music, but a good refresher on argparse module. Some points:
    * use type argument to add_argument rather than typecasting to int at a later stage
    * In PyCharm you do not compulsorily need to specify arguments in the Run Configuration, instead you can open a Python Terminal and run it from there as you would run from Terminal (Opt+F12 on Mac)

  4. Hi, What text editor are you using. Is it some IDE I have a hard time find an IDE that has auto-intellisense with python. Please let me know any IDE or editor that has auto intellisense. Thanks!!

  5. I thought about switch operator when we compare same variable multiple times in the code but I can't see it in documentation. If it's missing then is there another way to simplify if .. elif construction when you have to compare same variable multiple times? Thank you.

  6. Wonderful information! How could you command-line enter: either – – number_X or – – number_Y and leave the other number at the default value and receive the result=answer_A ? Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *