title: specifying a list as a command line argument in python
body: <p>I am using getopt to process a command line optional argument, which should accept a list. Something like this: </p>
  
  <pre><code>foo.py --my_list=[1, 2, 3, 4,5] 
  </code></pre>
  
  <p>But this trims everything after "[1,"</p>
  
  <p>My questions are:
  A) Is there a way to specify a list without converting it into a string? (using getopt) </p>
  
  <p>B) If I am to convert the list into a string, how to convert this list to a string? e.g. something like  mylist.split("?") to get rid of square brackets ?? is there a better way?</p>
  
  <p>Thank you</p>