textwrap.TextWrapper.width

width (default: 70) The maximum length of wrapped lines. As long as there are no individual words in the input text longer than width, TextWrapper guarantees that no output line will be longer than width characters.

textwrap.TextWrapper.tabsize

tabsize (default: 8) If expand_tabs is true, then all tab characters in text will be expanded to zero or more spaces, depending on the current column and the given tab size. New in version 3.3.

textwrap.TextWrapper.subsequent_indent

subsequent_indent (default: '') String that will be prepended to all lines of wrapped output except the first. Counts towards the length of each line except the first.

textwrap.TextWrapper.replace_whitespace

replace_whitespace (default: True) If true, after tab expansion but before wrapping, the wrap() method will replace each whitespace character with a single space. The whitespace characters replaced are as follows: tab, newline, vertical tab, formfeed, and carriage return ('\t\n\v\f\r'). Note If expand_tabs is false and replace_whitespace is true, each tab character will be replaced by a single space, which is not the same as tab expansion. Note If replace_whitespace is false, newlines may

textwrap.TextWrapper.placeholder

placeholder (default: ' [...]') String that will appear at the end of the output text if it has been truncated. New in version 3.4.

textwrap.TextWrapper.max_lines

max_lines (default: None) If not None, then the output will contain at most max_lines lines, with placeholder appearing at the end of the output. New in version 3.4.

textwrap.TextWrapper.initial_indent

initial_indent (default: '') String that will be prepended to the first line of wrapped output. Counts towards the length of the first line. The empty string is not indented.

textwrap.TextWrapper.fix_sentence_endings

fix_sentence_endings (default: False) If true, TextWrapper attempts to detect sentence endings and ensure that sentences are always separated by exactly two spaces. This is generally desired for text in a monospaced font. However, the sentence detection algorithm is imperfect: it assumes that a sentence ending consists of a lowercase letter followed by one of '.', '!', or '?', possibly followed by one of '"' or "'", followed by a space. One problem with this is algorithm is that it is unable

textwrap.TextWrapper.fill()

fill(text) Wraps the single paragraph in text, and returns a single string containing the wrapped paragraph.

textwrap.TextWrapper.expand_tabs

expand_tabs (default: True) If true, then all tab characters in text will be expanded to spaces using the expandtabs() method of text.