optparse and negative numbers as positional arguments

Tomi Silander tsilande at hiit.fi
Tue Apr 5 17:19:32 EDT 2005


Hi,
this must have been asked 1000 times (or nobody is as stupid as me),
but since I could not find the answer, here is the question.

My program mitvit.py:
--------------
import optparse
optparse.OptionParser().parse_args()
--------------
gives me

$ python2.4 ./mitvit.py -1.1
usage: mitvit.py [options]

mitvit.py: error: no such option: -1.1

How is one supposed to give negative numbers as positional arguments 
when using optparse?

ts.



More information about the Python-list mailing list