A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-March/042936.html below:

[Python-Dev] Re: Bug 911080, string split oddness

[Python-Dev] Re: Bug 911080, string split oddness [Python-Dev] Re: Bug 911080, string split oddnessPete Shinners pete at shinners.org
Sun Mar 7 01:12:12 EST 2004
Jeff Epler wrote:
> I think the current version documentation intends to explain the
> no-argument form with this sentence:
>     If sep is not specified or None, any whitespace string is a separator.
>     [http://python.org/doc/current/lib/string-methods.html#l2h-197]

I'm having a hard time making this clear. By reading the documentation I 
would guess that "split()" would be equivalent to 
"split(string.whitespace)". In fact they work very differently.

With no separator argument, the separators are grouped. The problem comes 
when your splitted string has multiple separators next to each other. To 
make them work the same is more like this

   mystr.split()
   filter(None, mystr.split(string.whitespace))


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4