runes wrote:
> The behaviour of "".split("*") is not that strange as the splitpoint
> always disappear. The re.split() have a nice option to keep the
> splitpoint which the str.split should have, I think.
>
> One expectation I keep fighting within myself is that I expect
>
> "mystring".split('') to return  ['m', 'y', 's', 't', 'r', 'i', 'n',
> 'g']. But I guess it's in line with "There should be one-- and
> preferably only one --obvious way to do it." that it's not so.

Fortunately, this is easy to write as: list("mystring").
Actually for me it's not so counter-intuitive that "mystring".split('')
doesn't work; what are you trying to split on?

Anyways, I usually need to split on something more complicated so I
split with regexes, usually.

cheers,

--Tim

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to