Answers for "getting a list of integers python"

1

pytho list items to int

numbers = [ int(x) for x in numbers ]
Posted by: Guest on August-13-2020
7

python convert list of strings to list of integers

# Basic syntax:
list_of_ints = [int(i) for i in list_of_strings]

# Example usage with list comprehension:
list_of_strings = ['2', '3', '47']
list_of_ints = [int(i) for i in list_of_strings]
print(list_of_ints)
--> [2, 3, 47]
Posted by: Guest on April-28-2021

Code answers related to "getting a list of integers python"

Python Answers by Framework

Browse Popular Code Answers by Language