since I got python on windows running, here is the next problem I encountered with argparse, and for which I did not see a solution. I uses optparse before. Here is my code:
import argparse
parser = argparse.ArgumentParser(
description = 'Test description') # main description for help
parser.add_argument('-d', '--dir', # -u or --user option
dest = "dir",
help = 'directory to start with')
args = parser.parse_args()
print(args.dir)
but when I run this code with either
code.py -d test
code.py --dir test
I always get a None
as output. I feel this is something trivial, and something obvious I overlooked, but I cannot see it.
Tanks
Alex