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

2 answers 237 views
1 answer 151 views
1 answer 197 views
1 answer 134 views
1 answer 99 views
1 answer 175 views
1 answer 155 views
...