Library for handling GNU parameters

Yermat loic at yermat.net1.nerim.net
Mon Feb 23 23:24:40 CET 2004


Peter Hansen a écrit :
> Florian Lindner wrote:
> 
>>is there a python library available for handling GNU parameters. For
>>example:
>>
>>prog --filename=foo.bar   is the same as  prog -f foo.bar
>>
>>or
>>
>>prog --execute   ==  prog -e
>>
>>I look for a library for parsing these string and represent the values in a
>>list.
> 
> 
> The standard library module getopt can do that, at least for the sort
> of example you show, and I suspect the newer standard library module
> optparse could also handle it (but haven't tried myself).
> 
> -Peter

Standard Module optparse

http://www.python.org/doc/2.3.3/lib/module-optparse.html

Note that if you do not have python2.3 you can just put the optparse.py 
and put it in you python2.2 directory, it will work !

-- 
Yermat




More information about the Python-list mailing list