Using optparse

Piet van Oostrum piet at cs.uu.nl
Thu Apr 23 11:43:27 EDT 2009


>>>>> loial <jldunn2000 at googlemail.com> (L) wrote:

>L> A shell script is passing parameters to my python script in the
>L> following format

>L> -PARAM1 12345 -PARAM2 67890

>L> Can I parse these with optparse  ? If so how?

>L> I can't seem to get it to work. It seems to expect --PARAM1 and --
>L> PARAM2

See the doc:

Some other option syntaxes that the world has seen include:
[...]
    * a hyphen followed by a whole word, e.g. "-file" [...]

These option syntaxes are not supported by optparse, and they never will be.

-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org



More information about the Python-list mailing list