Project Holy_Python_Grail_Quest - Argparse
In this post, I'll be sharing my notes on Argparse module on python. I've come across argparse module while working on my project. After googling, I've found this great tutorial at official python website: https://docs.python.org/2/howto/argparse.html . If you go through this, you'll get a very good idea about argparse and its usage. I'm just posting this as a summarized version of what I've understood from the tutorial. Anyone can go through this for quick reference. Introducing Positional Arguments : import argparse parser = argparse . ArgumentParser () parser . add_argument ( "square" , help = "display a square of a given number" , type = int ) args = parser . parse_args () print args . square ** 2 add_argument - To specify command line arguments the program is willing to accept parse_args() - returns some data from the options specified help - gives an idea about what the argument does a...