title: How to pass dictionary as command line argument to Python script?
body: <p>How to pass dictionary as command line argument to Python script?
  I need to get dictionary where key is string and value is list of some elements
  – for example to look like:</p>
  <pre><code>command_line_arguments = {&quot;names&quot; : [&quot;J.J.&quot;, &quot;April&quot;], &quot;years&quot; : [25, 29]}
  </code></pre>
  <p>I have tried like</p>
  <pre><code>if __name__ == '__main__':
      args = dict([arg.split('=') for arg in sys.argv[2:]]) # also tried with 1 but doesn't work
      main(args)
  </code></pre>
  <p>and I am calling script like</p>
  <pre><code>$ python saver.py names=[&quot;J.J.&quot;, &quot;April&quot;] years=[25, 29]
  </code></pre>
  <p>but it doesn't work, dictionary has length 0 and need 2. Can anyone help me to pass and create dictionary in main.</p>