Re: [argparse] optional parameter without --switch

2015-11-24 Thread Peter Otten
c.bu...@posteo.jp wrote: > I want to call (on bash) a Python script in this two ways without any > error. > > ./arg.py > ./arg.py TEST > > It means that the parameter (here with the value `TEST`) should be > optional. With argparse I only know a way to create optional paramters > when th

[argparse] optional parameter without --switch

2015-11-23 Thread c.buhtz
I want to call (on bash) a Python script in this two ways without any error. ./arg.py ./arg.py TEST It means that the parameter (here with the value `TEST`) should be optional. With argparse I only know a way to create optional paramters when they have a switch (like `--name`). Is there