How to split string by digits using regular expression in Python

1 Answer

0 votes
import re

s = 'python345java3c++12c948432swift'

lst = re.split('\d+', s)

print(lst)
 

 
 
'''
run:
 
['python', 'java', 'c++', 'c', 'swift']

'''

 



answered Oct 25, 2020 by avibootz

Related questions

1 answer 151 views
1 answer 169 views
1 answer 184 views
1 answer 211 views
...