Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 386b2b1

Browse files
committed
Merge with 3.4. Closes #21232.
2 parents dee46b3 + bddecc3 commit 386b2b1

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Doc/library/difflib.rst

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

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

233-
>>> diff = ndiff('one\ntwo\nthree\n'.splitlines(1),
234-
... 'ore\ntree\nemu\n'.splitlines(1))
233+
>>> diff = ndiff('one\ntwo\nthree\n'.splitlines(keepends=True),
234+
... 'ore\ntree\nemu\n'.splitlines(keepends=True))
235235
>>> print(''.join(diff), end="")
236236
- one
237237
? ^
@@ -254,8 +254,8 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
254254

255255
Example:
256256

257-
>>> diff = ndiff('one\ntwo\nthree\n'.splitlines(1),
258-
... 'ore\ntree\nemu\n'.splitlines(1))
257+
>>> diff = ndiff('one\ntwo\nthree\n'.splitlines(keepends=True),
258+
... 'ore\ntree\nemu\n'.splitlines(keepends=True))
259259
>>> diff = list(diff) # materialize the generated delta into a list
260260
>>> print(''.join(restore(diff, 1)), end="")
261261
one
@@ -660,7 +660,7 @@ obtained from the :meth:`~io.BaseIO.readlines` method of file-like objects):
660660
... 2. Explicit is better than implicit.
661661
... 3. Simple is better than complex.
662662
... 4. Complex is better than complicated.
663-
... '''.splitlines(1)
663+
... '''.splitlines(keepends=True)
664664
>>> len(text1)
665665
4
666666
>>> text1[0][-1]
@@ -669,7 +669,7 @@ obtained from the :meth:`~io.BaseIO.readlines` method of file-like objects):
669669
... 3. Simple is better than complex.
670670
... 4. Complicated is better than complex.
671671
... 5. Flat is better than nested.
672-
... '''.splitlines(1)
672+
... '''.splitlines(keepends=True)
673673

674674
Next we instantiate a Differ object:
675675

0 commit comments

Comments
 (0)