Commit 42e5c5e1 authored by Andrew M. Kuchling's avatar Andrew M. Kuchling

Rearrange example a bit, and show rpartition() when separator is not found

parent 1b805ac2
......@@ -1115,12 +1115,14 @@ Some examples:
\begin{verbatim}
>>> ('http://www.python.org').partition('://')
('http', '://', 'www.python.org')
>>> (u'Subject: a quick question').partition(':')
(u'Subject', u':', u' a quick question')
>>> ('file:/usr/share/doc/index.html').partition('://')
('file:/usr/share/doc/index.html', '', '')
>>> (u'Subject: a quick question').partition(':')
(u'Subject', u':', u' a quick question')
>>> 'www.python.org'.rpartition('.')
('www.python', '.', 'org')
>>> 'www.python.org'.rpartition(':')
('', '', 'www.python.org')
\end{verbatim}
(Implemented by Fredrik Lundh following a suggestion by Raymond Hettinger.)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment