I've read several questions about this on SO, however, none of them worked out for me - I guess I'm doing something wrong.
I have a string with numbers separated with commas and spaces which looks like this:
my_string = '32, 76, 82, 19, 25'
Now what I would like to have is a list of integers of the numbers in the string above, so I can extract single integers from it like this:
print my_list[2]
>>>82
or
print my_list[4]
>>>25
Thanks in advance!
The most pythonic way would be
Of course you can build a simple for loop if you prefer, like
There are plenty of possibilities
Split the problem into two parts.
1 Split the text into a list with the data you need and filter the other.
2 Convert the data into what type you want it
Then you might clean it up