textwrap — Formatting Text Paragraphs — PyMOTW 3
The textwrap module can be used to format text for output in situations where pretty-printing is desired. It offers programmatic functionality similar to the paragraph wrapping or filling features found in many text editors and word processors.
This post is part of the Python Module of the Week series for Python 3. See PyMOTW.com for more articles from the series.