Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
f8797dc1
Commit
f8797dc1
authored
Apr 18, 2014
by
Terry Jan Reedy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #21232: Replace .splitlines arg '1' with 'keepends=True'.
parent
4605601e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
Doc/library/difflib.rst
Doc/library/difflib.rst
+6
-6
No files found.
Doc/library/difflib.rst
View file @
f8797dc1
...
...
@@ -226,8 +226,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.
>>> diff = ndiff('one\ntwo\nthree\n'.splitlines(
1
),
... 'ore\ntree\nemu\n'.splitlines(
1
))
>>> diff = ndiff('one\ntwo\nthree\n'.splitlines(
keepends=True
),
... 'ore\ntree\nemu\n'.splitlines(
keepends=True
))
>>> print(''.join(diff), end="")
- one
? ^
...
...
@@ -250,8 +250,8 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
Example:
>>> diff = ndiff('one\ntwo\nthree\n'.splitlines(
1
),
... 'ore\ntree\nemu\n'.splitlines(
1
))
>>> diff = ndiff('one\ntwo\nthree\n'.splitlines(
keepends=True
),
... 'ore\ntree\nemu\n'.splitlines(
keepends=True
))
>>> diff = list(diff) # materialize the generated delta into a list
>>> print(''.join(restore(diff, 1)), end="")
one
...
...
@@ -650,7 +650,7 @@ obtained from the :meth:`~io.BaseIO.readlines` method of file-like objects):
... 2. Explicit is better than implicit.
... 3. Simple is better than complex.
... 4. Complex is better than complicated.
... '''.splitlines(
1
)
... '''.splitlines(
keepends=True
)
>>> len(text1)
4
>>> text1[0][-1]
...
...
@@ -659,7 +659,7 @@ obtained from the :meth:`~io.BaseIO.readlines` method of file-like objects):
... 3. Simple is better than complex.
... 4. Complicated is better than complex.
... 5. Flat is better than nested.
... '''.splitlines(
1
)
... '''.splitlines(
keepends=True
)
Next we instantiate a Differ object:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment