python convert all elements in list to int code example

Example 1: convert list of strings to ints python

test_list = ['1', '4', '3', '6', '7'] 

int_list = [int(i) for i in test_list]

Example 2: change list to int in python

test_list = list(map(int,test_list))

Example 3: pytho list items to int

numbers = [ int(x) for x in numbers ]

Example 4: change string list to int list python

Use the map function (in Python 2.x):
results = map(int, results)

In Python 3, you will need to convert the result from map to a list:
results = list(map(int, results))

Example 5: how to make all elements in array int python

numbers = [ int(x) for x in numbers ]

Example 6: how to make all elements in array int python

for i, v in enumerate(numbers): numbers[i] = int(v)