argparse: delimiter for argparse list arguments

Sven R. Kunze srkunze at mail.de
Tue Aug 3 17:06:11 EDT 2021


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?


Best
Sven

On 03.08.21 01:49, Dan Stromberg wrote:
>
> Isn't -- usually used to signal the end of options?
>
> On Mon, Aug 2, 2021 at 12:52 PM Sven R. Kunze <srkunze at mail.de 
> <mailto:srkunze at mail.de>> wrote:
>
>     Hi everyone,
>
>     maybe, I am missing something here but is it possible to specify a
>     delimiter for list arguments in argparse:
>
>     https://docs.python.org/3/library/argparse.html
>     <https://docs.python.org/3/library/argparse.html>
>
>     Usually, '--' is used to separate two lists (cf. git).
>
>     Cheers,
>     Sven
>
>     -- 
>     https://mail.python.org/mailman/listinfo/python-list
>     <https://mail.python.org/mailman/listinfo/python-list>
>


More information about the Python-list mailing list