textwrap
The standard library module for wrapping, filling, indenting and shortening paragraphs of text.
In more detail
textwrap.fill(text, width=40) breaks a long string into lines of at most 40 characters at word boundaries. textwrap.dedent removes the common indentation from a triple-quoted string.
Related terms
- string — A sequence of characters, that is, a piece of text.
- standard library — The collection of modules that ships with a programming language, available without installing anything extra.
Taught in
- A Standard Library Tour — Hands-on Python: Complete Video Course & Book