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> 



_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to