mirror of https://github.com/python/cpython
Merge with 3.4. Closes #21232.
This commit is contained in:
commit
386b2b18f5
|
@ -230,8 +230,8 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
|
||||||
|
|
||||||
:file:`Tools/scripts/ndiff.py` is a command-line front-end to this function.
|
:file:`Tools/scripts/ndiff.py` is a command-line front-end to this function.
|
||||||
|
|
||||||
>>> diff = ndiff('one\ntwo\nthree\n'.splitlines(1),
|
>>> diff = ndiff('one\ntwo\nthree\n'.splitlines(keepends=True),
|
||||||
... 'ore\ntree\nemu\n'.splitlines(1))
|
... 'ore\ntree\nemu\n'.splitlines(keepends=True))
|
||||||
>>> print(''.join(diff), end="")
|
>>> print(''.join(diff), end="")
|
||||||
- one
|
- one
|
||||||
? ^
|
? ^
|
||||||
|
@ -254,8 +254,8 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
>>> diff = ndiff('one\ntwo\nthree\n'.splitlines(1),
|
>>> diff = ndiff('one\ntwo\nthree\n'.splitlines(keepends=True),
|
||||||
... 'ore\ntree\nemu\n'.splitlines(1))
|
... 'ore\ntree\nemu\n'.splitlines(keepends=True))
|
||||||
>>> diff = list(diff) # materialize the generated delta into a list
|
>>> diff = list(diff) # materialize the generated delta into a list
|
||||||
>>> print(''.join(restore(diff, 1)), end="")
|
>>> print(''.join(restore(diff, 1)), end="")
|
||||||
one
|
one
|
||||||
|
@ -660,7 +660,7 @@ obtained from the :meth:`~io.BaseIO.readlines` method of file-like objects):
|
||||||
... 2. Explicit is better than implicit.
|
... 2. Explicit is better than implicit.
|
||||||
... 3. Simple is better than complex.
|
... 3. Simple is better than complex.
|
||||||
... 4. Complex is better than complicated.
|
... 4. Complex is better than complicated.
|
||||||
... '''.splitlines(1)
|
... '''.splitlines(keepends=True)
|
||||||
>>> len(text1)
|
>>> len(text1)
|
||||||
4
|
4
|
||||||
>>> text1[0][-1]
|
>>> text1[0][-1]
|
||||||
|
@ -669,7 +669,7 @@ obtained from the :meth:`~io.BaseIO.readlines` method of file-like objects):
|
||||||
... 3. Simple is better than complex.
|
... 3. Simple is better than complex.
|
||||||
... 4. Complicated is better than complex.
|
... 4. Complicated is better than complex.
|
||||||
... 5. Flat is better than nested.
|
... 5. Flat is better than nested.
|
||||||
... '''.splitlines(1)
|
... '''.splitlines(keepends=True)
|
||||||
|
|
||||||
Next we instantiate a Differ object:
|
Next we instantiate a Differ object:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue