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/2005-August/055874.html below:

[Python-Dev] Proof of the pudding: str.partition()

[Python-Dev] Proof of the pudding: str.partition()Fredrik Lundh fredrik at pythonware.com
Wed Aug 31 01:05:20 CEST 2005
Ron Adam wrote:

> For cases where single values are desired, attribues could work.
>
> Slicing:
>        line = line.partition(';').head
>        line = line.partition('#').head
>
> But it gets awkward as soon as you want more than one.
>
>        sep, port = host.partition(':').head, host.partition(':').sep

unless you go for the piece approach

    host, port = host.piece(":", 1, 2)

(which, of course, is short for

    host, port = host.piece(":").group(1, 2)

)

and wait for Mr Eby to tell you that piece has nothing whatsoever
to do with string splitting.

</F> 



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