How to convert a string list to integer in python?
<p>I have the following list of values:</p>

<pre><code>DATA =  [['5', '1'], ['5', '5'], ['3', '1'], ['6', '1'], ['4', '3']]
</code></pre>

<p>How can I convert it to :</p>

<pre><code>DATA = [[5, 1], [5, 5], [3, 1], [6, 1], [4, 3]]
</code></pre>

<p>Note : I have already tried the following but all are not working in <strong>Python 3</strong> :</p>

<pre><code>   1. DATA = [int(i) for i in DATA] 
   2. DATA = list(list(int(a) for a in b) for b in DA if a.isdigit())
   3. DATA = [map(int,x) for x in DATA]
</code></pre>

<p>Please help me with this. Thanks!!</p>

<p>Your third one is actually correct. In Python 3 <a href="https://docs.python.org/3/library/functions.html#map">map</a> returns a map object, so you just have to call <code>list</code> on it to get a <em>list</em>. </p>

<pre><code>DATA =  [['5', '1'], ['5', '5'], ['3', '1'], ['6', '1'], ['4', '3']]

d = [list(map(int, x)) for x in DATA]

# Output:
# [[5, 1], [5, 5], [3, 1], [6, 1], [4, 3]]

# type of one of the items in the sublist
# print(type(d[0][0])
# &lt;class 'int'&gt;
</code></pre>

python python-3.x