How to write command-line arguments using argparse in python

If you want to run a .py python file from command line and you also want to pass the argument using command line you can use argparse library. This can be done as below: Then you cal run this py file on command line as below python –my_var 7 Thanks

Read More