title: converting each element from string to int in nested list in python
body: <p>I have data in python with nested lists, a part of which looks like:</p>
  <pre><code>data = [['214', '205', '0', '14', '710', '1813494849', '0'], ['214', '204', '0', '30', '710', '1813494856', '0'], ['214', '204', '0', '34', '710', '1813494863', '0'], ['213', '204', '0', '35', '710', '1813494870', '0'], ['213', '203', '0', '35', '710', '1813494877', '0']]
  </code></pre>
  <p>While converting the data using couple methods:</p>
  <p>1.</p>
  <pre><code> new_data_list = [[int(x) for x in list] for list in data]
  </code></pre>
  <ol start="2">
  <li>
  <pre><code>  list=[]
    for i in range(0,len(data)):
        list.append([])
        for j in range(0,len(data[i])):
            b=int(data[i][j])
            list[i].append(b)
  </code></pre>
  </li>
  </ol>
  <p>I am getting the error which says:</p>
  <pre><code>&gt; ValueError: invalid literal for int() with base 10: ''
  </code></pre>
  <p>There are no non-numeric data in my list of data. But there might be something with the header, like an empty header treated as non-numeric value as I have created a list of data from csv.</p>
  <p>I wanted to know an efficient way which can convert each element of the list to int while keeping the data multi list.</p>