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,439
  • 4
  • 21
  • 36
quickbug
  • 4,434
  • 5
  • 16
  • 20

1 Answers1

0

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
  • 521
  • 3
  • 13