How to convert some string fields in list to integer in Python?
<p>I have a string list and want to convert last value to integer, </p>

<pre><code>[['wind turbine', 'feed induction generator', '16'],
['wind turbine', 'dynamic model', '6'],
['electrical model', 'dynamic model', '4']]
</code></pre>

<p>I want just convert last fields to integer. </p>

<p>results something like this:</p>

<pre><code>[['wind turbine', 'feed induction generator', 16  ],
['wind turbine', 'dynamic model', 6  ],
['electrical model', 'dynamic model', 4  ]]
</code></pre>

<pre><code>L = [['wind turbine', 'feed induction generator', '16'],['wind turbine', 'dynamic model', '6'],['electrical model', 'dynamic model', '4']]

for i in L:
    i[-1] = int(i[-1])
print(L)
</code></pre>

<p>hope this helps</p>

python