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 358 views
1 answer 242 views
1 answer 282 views
1 answer 229 views
1 answer 178 views
1 answer 284 views
1 answer 242 views
...