How to extract all digits from a string into a list using regex in Python

1 Answer

0 votes
import re

s = "1php23c++4python5java6"

f = re.findall(r'[0-9]+', s)

print(f)

 
 
   
'''
run:
   
['1', '23', '4', '5', '6']
   
'''

 



answered Aug 1, 2019 by avibootz
...