PyDocs

Nav

Text Processing Services

dedent

textwrap

function (source)
  • dedent(text)
Remove any common leading whitespace from every line in `text`.

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.

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.
Changed in 3.14
  • 3.14: The dedent() function now correctly normalizes blank lines containing only whitespace characters. Previously, the implementation only normalized blank lines containing tabs and spaces.
0 Examples
No examples for textwrap/dedent.
See Also
No see-alsos for textwrap/dedent
0 Notes
No notes for dedent