R. David Murray added the comment:

"Note that split will never split a string on an empty pattern match"

You can get what you want this way:

>>> re.split(r'(\w*)', 'a funky string')
['', 'a', ' ', 'funky', ' ', 'string', '']

Or use r'(\W*)' if you don't actually want the leading and training empty 
strings.

----------
nosy: +r.david.murray
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21551>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to