Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 11631

Hi, i have problem with my code, i want to create a new list from the list

$
0
0

The elements of the list are integers and strings, I want to convert them to integers first, but the program ignores the command int(i) and outputs a list with the same elements as the first list.

lista = [2,3,4,'5','6','7']lista_2 = []for i in lista:    int(i)    lista_2.append(i)print(lista_2)

Viewing all articles
Browse latest Browse all 11631

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>