On Jun 2, 2012 6:21 AM, "r.david.murray" <python-check...@python.org> wrote: > > http://hg.python.org/cpython/rev/24572015e24f > changeset: 77288:24572015e24f > branch: 3.2 > parent: 77285:bf6305bce3af > user: R David Murray <rdmur...@bitdance.com> > date: Fri Jun 01 16:19:36 2012 -0400 > summary: > #14957: clarify splitlines docs. > > Initial patch by Michael Driscoll, I added the example. > > files: > Doc/library/stdtypes.rst | 8 +++++++- > 1 files changed, 7 insertions(+), 1 deletions(-) > > > diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst > --- a/Doc/library/stdtypes.rst > +++ b/Doc/library/stdtypes.rst > @@ -1329,7 +1329,13 @@ > > Return a list of the lines in the string, breaking at line boundaries. Line > breaks are not included in the resulting list unless *keepends* is given and > - true. > + true. This method uses the universal newlines approach to splitting lines. > + Unlike :meth:`~str.split`, if the string ends with line boundary characters > + the returned list does ``not`` have an empty last element. > + > + For example, ``'ab c\n\nde fg\rkl\r\n'.splitlines()`` returns > + ``['ab c', '', 'de fg', 'kl']``, while the same call with ``splinelines(True)`` > + returns ``['ab c\n', '\n, 'de fg\r', 'kl\r\n']``.
s/splinelines/splitlines/ Maybe also show what split() would do for that string? > > > .. method:: str.startswith(prefix[, start[, end]]) > > -- > Repository URL: http://hg.python.org/cpython > > _______________________________________________ > Python-checkins mailing list > python-check...@python.org > http://mail.python.org/mailman/listinfo/python-checkins >
_______________________________________________ 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