Python Append String inside list just as an element without double quotes
<p>Clarification:</p>

<p>Problem here is I want to put content of list1 inside List2. I was doing it wrong way as suggested in comments.</p>

<p>I get a list1 
value4 = [{'PARAMS': ['ProcessingDate=2016-08-29', 'ReRun=Y']}]</p>

<p>The elements of the PARAMS should be suffixed with '-param' string, so I created a new list with elements of value4[0]['PARAMS'] Then removed the square brackets of this list which ended up as string
FINALPARAMS 
<code>'-param', 'ProcessingDate=2016-08-29', '-param', 'ReRun=Y'</code></p>

<p>Then I was trying to insert these values inside another list as elements.</p>

<p><code>myNewlist = ['C:\This\Path', 'value2', 'value3', FINALPARAMS, 'value5']</code></p>

<p>This gives output with doublequotes around the FINALPARAMS values</p>

<p><code>['C:\\This\\Path', 'value2', 'value3', "'-param', 'ProcessingDate=2016-08-29', '-param', 'ReRun=Y'", value5]</code></p>

<p>I want to get rid of the double quotes inside this new list</p>

<hr>

<p>Original Question:</p>

<p>This might be a easy solution for Python expert, but i am tired of finding solution. I have done most of the string manipulation I could do, like converting to string and trying out replace etc:</p>

<p>I have my list like below, I need to put the data of <code>value4</code> properly inside `mylist without double quotes.</p>

<p>using python 3.5</p>

<p>I get my <code>value4</code> like below</p>

<pre><code>   value4 = [{'PARAMS': ['ProcessingDate=2016-08-29', 'ReRun=Y']}]
</code></pre>

<p>I convert it to list like below, I need <code>-param</code> as suffix for my each element in <code>PARAMS</code></p>

<pre><code>paramlist   = value4[0]['PARAMS']
newparamlist = []
for x in paramlist:
    newparamlist.append('-param')
    newparamlist.append(x)
FINALPARAMS = (str(newparamlist)[1:-1]) #Taking out the squareBrackets
</code></pre>

<p><code>print FINALPARAMS</code> gives the desired result. i.e.</p>

<p><code>'-param', 'ProcessingDate=2016-08-29', '-param', 'ReRun=Y'</code></p>

<p>i use the <code>FINALPARAMS</code> in below list which prints value like this, i want to get rid of the double quotes and treat the string which i got from <code>FINALPARAMS</code> as normal list item inside the <code>myNewlist</code></p>

<p><code>myNewlist = ['C:\This\Path', 'value2', 'value3', FINALPARAMS, 'value5']</code></p>

<p><code>myNewlist</code> results as follows Observe the DoubleQuote I want to get rid of it so the values are treated as list items</p>

<p><code>['C:\\This\\Path', 'value2', 'value3', "'-param', 'ProcessingDate=2016-08-29', '-param', 'ReRun=Y'", value5]</code></p>

<p>I lost 4 hours finding the solution, which looked simple for me initially.
I tried converting this <code>newList</code> to string and replaced the doubleQuotes but my subprocess.checkoutput looks for proper list item</p>

<p>I tried converting the list to string and do <code>replace('"','')</code>  this turned out that it has put 4 backslashes to the windows path which is my first element in the list. and my command gave a error System cannot find the path specified</p>