title: How can I pass a list as a command-line argument with argparse?
body: <p>I am trying to pass a list as an argument to a command line program. Is there an <a href="https://docs.python.org/3/library/argparse.html" rel="noreferrer"><code>argparse</code></a> option to pass a list as option?</p>
  
  <pre><code>parser.add_argument('-l', '--list',
                        type=list, action='store',
                        dest='list',
                        help='&lt;Required&gt; Set flag',
                        required=True)
  </code></pre>
  
  <p>Script is called like below</p>
  
  <pre><code>python test.py -l "265340 268738 270774 270817"
  </code></pre>