Published
- 1 min read
How to extract numbers from a string in Python?
The solution for this is noted below
How to extract numbers from a string in Python?
Solution
>>> import re
>>> re.findall(r'\d+', "hello 42 I'm a 32 string 30")
['42', '32', '30']
Try other methods by searching on the site. That is if this doesn’t work