Parse args to json elements in python
<p>i have a data structure that i want to fill with cmd args</p>

<pre><code>params = {
  ...
  ...
  "blockX": "{\"nameX\":["\Arg1\","\Arg2\",\"Arg3\"........"\ArgX\"]}",
  ...
  ...
}
</code></pre>

<p>Then i run a post request with the params as data:</p>

<pre><code>r = requests.post("https://url", data=params)
</code></pre>

<p>I only know how to do it with one element</p>

<pre><code>"BlockX": "{\"nameX\": \"%s\"}" %ArgX,
</code></pre>

<p>Regards</p>

<p>If you have your arguments in <code>args</code> list, then you can try this:</p>

<pre><code>import json
params['blockX'] = json.dumps({'nameX': args})
</code></pre>

python json args