I have this little problem with argparse :
#!/usr/bin/python2.6
#test.py
import argparse
parser = argparse.ArgumentParser(description="test")
parser.add_argument('c', nargs='*')
parser.add_argument('cj', nargs='*')
results = vars(parser.parse_args())
print results
Now in the command line if I type in : "test.py c 1"
it returns this
{'cj': [], 'c': ['c', '1']}
but if I type in " "test.py cj 1"
it returns this :
{'cj': [], 'c': ['cj', '1']}
I am expecting the second example to return value in the 'cj' key, but it keeps on appears in the 'c' key.
what am I doing wrong ?
cheers,
add_argumentlines and see the change in the response.