Convert list of list of integers into a list of strings
<p>I have a list of strings:</p>

<pre><code>['[2, 8]', '[8, 2]', '[2, 5, 3]', '[2, 5, 3, 0]', '[5, 3, 0, 2]']  
</code></pre>

<p>I want output to look like </p>

<pre><code>['28','82','253',2530',5302']
</code></pre>

<p>I've tried using   </p>

<pre><code>string1= ''.join(str(e) for e in list[0])
</code></pre>

<p>I get output for print (string1) as:</p>

<pre><code>[2, 8]
</code></pre>

<p>What am i doing wrong here?</p>

<p>You actually don't have a <code>list</code> of <code>list</code>, you have a <code>list</code> of <code>str</code>. Therefore you can use <a href="https://docs.python.org/3/library/ast.html#ast.literal_eval" rel="nofollow"><code>ast.literal_eval</code></a> to interpret each string as a list, then convert to <code>str</code> and <code>join</code>.</p>

<pre><code>&gt;&gt;&gt; l = ['[2, 8]', '[8, 2]', '[2, 5, 3]', '[2, 5, 3, 0]', '[5, 3, 0, 2]']
&gt;&gt;&gt; from ast import literal_eval
&gt;&gt;&gt; [''.join(str(j) for j in literal_eval(i)) for i in l]
['28', '82', '253', '2530', '5302']
</code></pre>

python string list