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

Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
reset what the current doc was
  • Loading branch information
Marius-Juston committed Mar 27, 2025
commit 8dce5ab5ef9e996ce5dd5d52867bb844cf9d89b7
15 changes: 9 additions & 6 deletions Lib/textwrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,14 +415,17 @@ def shorten(text, width, **kwargs):
# -- Loosely related functionality -------------------------------------

def dedent(text):
"""
Remove any common leading whitespace from every line in text.
"""Remove any common leading whitespace from every line in `text`.

Entirely blank lines are normalized to a newline character.
Tabs and spaces are treated as distinct.
This can be used to make triple-quoted strings line up with the left
edge of the display, while still presenting them in the source code
in indented form.

This implementation uses os.path.commonprefix (implemented in C)
to compute the common margin of non-blank lines for maximal performance.
Note that tabs and spaces are both treated as whitespace, but they
are not equal: the lines " hello" and "\\thello" are
considered to have no common leading whitespace.

Entirely blank lines are normalized to a newline character.
"""
# Fast paths for empty or simple text
if not text:
Expand Down
Loading