Python : parsing the command line options using optparse

sffjunkie at gmail.com sffjunkie at gmail.com
Wed Feb 26 05:55:16 EST 2014


On Wednesday, 26 February 2014 09:30:21 UTC, Ganesh Pal  wrote:
> Here is what is happening ( only short hand with -)
> 
> # python-5.py -p=/ifs/1.txt -q=XOR  -f=1234 -n=1 -l
> 
> Usage: python-5.py [options]
> python-5.py: error: option -q: invalid choice: '=XOR' (choose from 'XOR', 'ADD',
> 
>  'SET', 'MODIFY', 'RENAME', 'DELETE', 'KILL')

Short hand options don't use '=' signs. Try

python-5.py -p /ifs/1.txt -q XOR  -f 1234 -n 1 -l

--Simon



More information about the Python-list mailing list