optparse multiple arguments

Steven Bethard steven.bethard at gmail.com
Fri Jun 30 21:10:33 EDT 2006


Ritesh Raj Sarraf wrote:
> Now if someone uses it as:
> ./foo --my-option a b c
> 
> I want somehow to store all the three arguments

Currently optparse doesn't support options with an arbitrary number of 
arguments.  I'm currently working on a optparse-inspired replacement 
which does support this along the lines of:

     parser.add_option('--my-option', nargs='*')

but it's not quite ready for prime-time yet.  I'm hoping to put an 
announcement out in the next couple of weeks.

STeVe



More information about the Python-list mailing list