Added a note and examples to explain that re.split does not split on an

empty pattern match. (issue 852532).
This commit is contained in:
Skip Montanaro 2007-09-01 17:40:03 +00:00
parent 847cae6743
commit 222907da56
1 changed files with 7 additions and 0 deletions

View File

@ -544,6 +544,13 @@ form.
>>> re.split('\W+', 'Words, words, words.', 1)
['Words', 'words, words.']
Note that *split* will never split a string on an empty pattern match.
For example ::
>>> re.split('x*', 'foo')
['foo']
>>> re.split("(?m)^$", "foo\n\nbar\n")
['foo\n\nbar\n']
.. function:: findall(pattern, string[, flags])