title: How to pass an entire list as command line argument in Python?
body: <p>I was trying to pass two lists containing integers as arguments to a python code. But <code>sys.argv[i]</code> gets the parameters as a list of string. </p>
  
  <p>Input would look like, </p>
  
  <pre><code>$ python filename.py [2,3,4,5] [1,2,3,4]
  </code></pre>
  
  <p>I found the following hack to convert the list.</p>
  
  <pre><code>strA = sys.argv[1].replace('[', ' ').replace(']', ' ').replace(',', ' ').split()
  strB = sys.argv[2].replace('[', ' ').replace(']', ' ').replace(',', ' ').split()
  A = [float(i) for i in strA]
  B = [float (i) for i in strB]
  </code></pre>
  
  <p>Is there a better way to do this?</p>