I want the user to provide some external arguments while calling a python script from command line, what changes I suppose to make inside my python script to add this functionality?
1 Answer
I think this is what you are looking for
pass arguments in command line.
$ python test.py arg1 arg2 arg3
access it using sys.argv which gives list of arguments that you entered above
import sys
print 'Number of arguments:', len(sys.argv), 'arguments.'
print 'Argument List:', str(sys.argv)
sys.argvorargparse