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

Taught in

References