On Sep 2, 1:45 pm, Neal Becker <ndbeck...@gmail.com> 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 (http://pypi.python.org/pypi/plac) you would write the following: import plac @plac.annotations( option1=('option with comma separated values', 'option', 'o', lambda x: x.split(','))) def main(option1): print option1 if __name__ == '__main__': plac.call(main) -- http://mail.python.org/mailman/listinfo/python-list