Parsing cmd line args problem
shalabh at cafepy.com
Sat Apr 10 02:52:35 CEST 2004
Paulo da Silva wrote:
> 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.
> prog -i xxx -i yyy
> and get a list like [[xxx,1],[yyy,1]]
> I have tried this (callback) without any success:
> Any help please?
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.
More information about the Python-list