0

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.

riteshtch
  • 8,629
  • 4
  • 25
  • 38
quickbug
  • 4,708
  • 5
  • 17
  • 21

1 Answers1

1

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']
Aswin P J
  • 546
  • 4
  • 13