[docs] [issue14244] No information about behaviour with groups in pattern in the docstring for re.split

py.user report at bugs.python.org
Sat Mar 10 09:42:14 CET 2012


py.user <port139 at yandex.ru> added the comment:

"+    returning a list containing the resulting substrings.  If
+    capturing parentheses are used in pattern, then the text of all
+    groups in the pattern are also returned as part of the resulting
+    list."

not only text

>>> import re
>>> re.split(r'(a)(x)?', 'abcabc')
['', 'a', None, 'bc', 'a', None, 'bc']
>>>

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14244>
_______________________________________


More information about the docs mailing list