argparse list

Neal Becker ndbecker2 at gmail.com
Thu Sep 2 08:26:35 EDT 2010


Peter Otten wrote:

>>>> import argparse
>>>> def csv(value):
> ...     return map(int, value.split(","))
> ...
>>>> p = argparse.ArgumentParser()
>>>> p.add_argument("--option1", type=csv) and None
>>>> p.parse_args(["--option1=1,10,37"])

Thanks!  But, why the 'and None'?




More information about the Python-list mailing list