How to split string by one or more adjacent commas in Python

1 Answer

0 votes
import re

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

s = re.split(',+', s)
 
print(s)
 
 
 
'''
run:
 
['python', 'java', 'c++', 'c']
 
'''

 



answered Oct 26, 2020 by avibootz

Related questions

1 answer 247 views
1 answer 284 views
1 answer 231 views
1 answer 179 views
1 answer 286 views
1 answer 243 views
...