I have an index where words are split in syllabes in the form 'foo-bar' and I want to create the list ['foo', 'bar']
.
I am new to python, and especially to the re
module. So do I ask for the best way to do this instead of writing ugly code.
I have an index where words are split in syllabes in the form 'foo-bar' and I want to create the list ['foo', 'bar']
.
I am new to python, and especially to the re
module. So do I ask for the best way to do this instead of writing ugly code.
There is no need of using any module. Use the inbuilt string split method.
a = "a-b-cde"
b = a.split('-')
#b contains ['a','b','cde']