I want quotes around "arg1" "arg2" to be considered as separate arguments not in the same list and "arg1 arg2" as separate arguments but in the same list.
test.py taken from here
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--nargs', nargs='*')
for _, value in parser.parse_args()._get_kwargs():
if value is not None:
print(value)
run 1
python test.py --nargs "arg arg2"
output 1
['arg arg2']
I guess this is fine? But are arg and arg2 considered separate arguments?
run 2
python test.py --nargs "arg" "arg2"
output 2
['arg', 'arg2']
In the same list but are they considered separate arguments? I need them to be something like:
['arg'] ['arg2']