How to split string using regular expression in Python

1 Answer

0 votes
import re

s = 'python##java,,c++,#c###,swift'

lst = re.split('[#,][#,]', s)

print(lst)
 

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

'''

 



answered Oct 25, 2020 by avibootz

Related questions

...