Le mardi 30 août 2005 à 12:29 -0500, [EMAIL PROTECTED] a écrit :
> Just group your re:
> 
>     >>> import re
>     >>>
>     >>> re.split("ab", "abracadabra")
>     ['', 'racad', 'ra']
>     >>> re.split("(ab)", "abracadabra")
>     ['', 'ab', 'racad', 'ab', 'ra']
> 
> and you get it in the return value.  In fact, re.split with a grouped re is
> very much like Raymond's str.partition method without the guarantee of
> returning a three-element list.

Thanks! I guess I should have read the documentation carefully instead
of assuming re.split() worked like in some other language (namely, PHP).

Regards

Antoine.


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to