Bengt Richter wrote:
On Wed, 20 Apr 2005 10:55:18 +0200, David Fraser <[EMAIL PROTECTED]> wrote:
Greg Ewing wrote:
Will McGugan wrote:
Hi,
I'm curious about the behaviour of the str.split() when applied to
empty strings.
"".split() returns an empty list, however..
"".split("*") returns a list c
On Wed, 20 Apr 2005 10:55:18 +0200, David Fraser <[EMAIL PROTECTED]> wrote:
>Greg Ewing wrote:
>> Will McGugan wrote:
>>
>>> Hi,
>>>
>>> I'm curious about the behaviour of the str.split() when applied to
>>> empty strings.
>>>
>>> "".split() returns an empty list, however..
>>>
>>> "".split("*")
Greg Ewing wrote:
Will McGugan wrote:
Hi,
I'm curious about the behaviour of the str.split() when applied to
empty strings.
"".split() returns an empty list, however..
"".split("*") returns a list containing one empty string.
Both of these make sense as limiting cases.
Consider
>>> "a b c".spli
Will McGugan wrote:
Hi,
I'm curious about the behaviour of the str.split() when applied to empty
strings.
"".split() returns an empty list, however..
"".split("*") returns a list containing one empty string.
Both of these make sense as limiting cases.
Consider
>>> "a b c".split()
['a', 'b', 'c']
[Will McGugan]
> >I'm curious about the behaviour of the str.split() when applied to empty
> >strings.
> >
> >"".split() returns an empty list, however..
> >
> >"".split("*") returns a list containing one empty string.
[John Machin]
> You are missing a perusal of the documentation. Had you done so
On Mon, 18 Apr 2005 16:16:00 +0100, Will McGugan
<[EMAIL PROTECTED]> wrote:
>Hi,
>
>I'm curious about the behaviour of the str.split() when applied to empty
>strings.
>
>"".split() returns an empty list, however..
>
>"".split("*") returns a list containing one empty string.
>
>I would have expect
[Tim N. van der Leeuw]
> Fortunately, this is easy to write as: list("mystring").
Sure, and map(None, "mystring")
Anyways, I have settled with this bevaviour, more or less ;-)
Rune
--
http://mail.python.org/mailman/listinfo/python-list
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('') t
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',
Hi,
I'm curious about the behaviour of the str.split() when applied to empty
strings.
"".split() returns an empty list, however..
"".split("*") returns a list containing one empty string.
I would have expected the second example to have also returned an empty
list. What am I missing?
TIA,
Will
10 matches
Mail list logo