string of numbers to list of integers python code example
Example 1: string of numbers to list of integers python
a_string = "1 2 3"
a_list = a_string. split()
#a_list >>> ['1','2','3']
int_list = [int(i) for i in list]
Example 2: python string to list of int
[int(s) for s in example_string.split(',')]