argparse: delimiter for argparse list arguments
Chris Angelico
rosuav at gmail.com
Tue Aug 3 17:20:52 EDT 2021
On Wed, Aug 4, 2021 at 7:07 AM Sven R. Kunze <srkunze at mail.de> wrote:
>
> It could be but I've seen them used somewhere else.
>
> I wouldn't bikeshed on this yet, as I haven't found a way to do this so
> far. Let's imagine the following parser:
>
> parser.add_argument('things',action='append')
> parser.add_argument('stuff',action='append')
>
> At least from my point of view, I don't any way to separate both lists
> on this command call:
>
>
> cool-script.py thing1 thing2 stuff1 stuff2
>
>
> Do I miss something here?
>
I'd probably design it like this:
cool-script.py --things thing1 thing2 --stuff stuff1 stuff2
which argparse already handles.
ChrisA
More information about the Python-list
mailing list