Small inconsistency between string.split and "".split
Carlos Ribeiro
carribeiro at gmail.com
Mon Sep 13 13:41:33 EDT 2004
On Mon, 13 Sep 2004 13:09:26 -0400, Peter Hansen <peter at engcorp.com> wrote:
> Works here:
> <snip>
> >>> s.split('s', 1)
> ['thi', ' is my string']
> >>> s.split('s', 2)
Unfortunately, this is *not* what I had meant to ask for. What I am
saying is that:
import strings
strings.split(maxsplit=1)
works, while
mystring.split(maxsplit=1)
doesn't. In short, the builtin string method doesn't accept keyword
parameters while the strings.split() function does. Alas, the "None"
trick is not documented -- and without knowing about it, I had no
other way around.
--
Carlos Ribeiro
Consultoria em Projetos
blog: http://rascunhosrotos.blogspot.com
blog: http://pythonnotes.blogspot.com
mail: carribeiro at gmail.com
mail: carribeiro at yahoo.com
More information about the Python-list
mailing list