Parsing cmd line args problem
Shalabh Chaturvedi
shalabh at cafepy.com
Fri Apr 9 20:52:35 EDT 2004
Paulo da Silva wrote:
> Hi.
>
> I am writing my 1st. python program and I have the following problem:
>
> I need to build a list of lists (or tuples) for every -i option.
> Example:
> prog -i xxx -i yyy
> and get a list like [[xxx,1],[yyy,1]]
>
> I have tried this (callback) without any success:
<example snipped>
>
>
> Any help please?
> Thanks
It might be easier to just collect all values for the option in one list and
later sort, count or do whatever with it. I believe there is an action in
optparse to append values.
--
Shalabh
More information about the Python-list
mailing list