nargs
- n
umber of arg
uments
+
- 1 or more arguments*
- 0 or more arguments?
- 0 or 1 arguments[some number]
- Specify an explicit number of arguments
action
- What action to perform on the arguments
'append'
- Append all arguments together
Now, in the command line, to specify a 2D list as an argument, the specified argument switch name can be used each time for a 1D list
python test.py -i 1 2 3 -i 4 5 6 -i 7 8 9
The append
action will append all the -i
arguments and nargs='+'
tells the computer that there are more than 1 arguments to process