Skip to content

Commit bddecc3

Browse files
committed
Issue python#21232: Replace .splitlines arg '1' with 'keepends=True'.
1 parent a37ff0f commit bddecc3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Doc/library/difflib.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
226226

227227
:file:`Tools/scripts/ndiff.py` is a command-line front-end to this function.
228228

229-
>>> diff = ndiff('one\ntwo\nthree\n'.splitlines(1),
230-
... 'ore\ntree\nemu\n'.splitlines(1))
229+
>>> diff = ndiff('one\ntwo\nthree\n'.splitlines(keepends=True),
230+
... 'ore\ntree\nemu\n'.splitlines(keepends=True))
231231
>>> print(''.join(diff), end="")
232232
- one
233233
? ^
@@ -250,8 +250,8 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
250250

251251
Example:
252252

253-
>>> diff = ndiff('one\ntwo\nthree\n'.splitlines(1),
254-
... 'ore\ntree\nemu\n'.splitlines(1))
253+
>>> diff = ndiff('one\ntwo\nthree\n'.splitlines(keepends=True),
254+
... 'ore\ntree\nemu\n'.splitlines(keepends=True))
255255
>>> diff = list(diff) # materialize the generated delta into a list
256256
>>> print(''.join(restore(diff, 1)), end="")
257257
one
@@ -650,7 +650,7 @@ obtained from the :meth:`~io.BaseIO.readlines` method of file-like objects):
650650
... 2. Explicit is better than implicit.
651651
... 3. Simple is better than complex.
652652
... 4. Complex is better than complicated.
653-
... '''.splitlines(1)
653+
... '''.splitlines(keepends=True)
654654
>>> len(text1)
655655
4
656656
>>> text1[0][-1]
@@ -659,7 +659,7 @@ obtained from the :meth:`~io.BaseIO.readlines` method of file-like objects):
659659
... 3. Simple is better than complex.
660660
... 4. Complicated is better than complex.
661661
... 5. Flat is better than nested.
662-
... '''.splitlines(1)
662+
... '''.splitlines(keepends=True)
663663

664664
Next we instantiate a Differ object:
665665

0 commit comments

Comments
 (0)