Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

get number in string python

from itertools import groupby
my_str = "hello 12 hi 89"

l = [int(''.join(i)) for is_digit, i in groupby(my_str, str.isdigit) if is_digit]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #number #string #python
ADD COMMENT
Topic
Name
3+4 =