argparse list

Michele Simionato michele.simionato at
Thu Sep 2 16:11:27 CEST 2010

On Sep 2, 1:45 pm, Neal Becker <ndbeck... at> wrote:
> I'm interested in using argparse to parse a string formatted as:
> my_prog --option1=1,10,37
> That is, a list of comma delimited values.  I guess nargs almost does it,
> but expects options to be space-delimited.
> What would be the easiest approach?

In plac ( you would write the

import plac

    option1=('option with comma separated values',
             lambda x: x.split(',')))
def main(option1):
    print option1

if __name__ == '__main__':

More information about the Python-list mailing list