
![]() | Split a string into words:
string.split(line, splitstring) |
![]() | Split wrt a regular expression:
>>> re.split(r"\s+", "some words in a text") ['some', 'words', 'in', 'a', 'text'] |
![]() |
Notice the effect of this:
>>> re.split(r" ", "some words in a text") ['some', '', '', '', 'words', '', '', 'in', 'a', 'text'] |