python argparse allowed values code example
Example 1: arg parse array argument
parser.add_argument("--list", nargs="+", default=["a", "b"])
SHELL
$ python3 example.py --list a b c
# List would look like ['a','b','c']
Example 2: argparse accept only few options
...
parser.add_argument('--val',
choices=['a', 'b', 'c'],
help='Special testing value')
args = parser.parse_args(sys.argv[1:])