I want to run Parser for command-line options, taken from official Python 2.7 documentation https://docs.python.org/2/library/argparse.html#module-argparse using MS Visual Studion 2015 (Python Tools). I created script named prog.py.
#file_name='prog.py'
import argparse
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('integers', metavar='N', type=int, nargs='+',
help='an integer for the accumulator')
parser.add_argument('--sum', dest='accumulate', action='store_const',
const=sum, default=max,
help='sum the integers (default: find the max)')
args = parser.parse_args()
print args.accumulate(args.integers)
I usually run my scripts selecting several lines of code and pressing Ctrl+E,E. But this time I need to run the whole script with additional command line arguments. In this particular case I want execute commands:
python prog.py -h
to see help from my script. And:
python prog.py 1 2 3 4
python prog.py 1 2 3 4 --sum
to see how it worked. The result must be visible in Python 2.7 Interactive window in Visual Studio Environment. How do they do this in MS Visual Studio 2015?