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 235 views
1 answer 149 views
1 answer 195 views
1 answer 131 views
1 answer 97 views
1 answer 174 views
1 answer 153 views
...