Split the problem into two parts.
1 Split the text into a list with the data you need and filter the other.
num_list = my_string.split(',')
2 Convert the data into what type you want it
integers = [int(x) for x in num_list]
Then you might clean it up
integs = [int(x) for x in my_string.split(',')]