How can I pass a list as a command-line argument with argparse?

I am trying to pass a list as an argument to a command line program. Is there an argparse option to pass a list as option?

parser.add_argument('-l', '--list',
                      type=list, action='store',
                      dest='list',
                      help=' Set flag',
                      required=True)

Script is called like below

python test.py -l "265340 268738 270774 270817"

← Назад к списку