textwrap.indent()

textwrap.indent(text, prefix, predicate=None) Add prefix to the beginning of selected lines in text. Lines are separated by calling text.splitlines(True). By default, prefix is added to all lines that do not consist solely of whitespace (including any line endings). For example: >>> s = 'hello\n\n \nworld' >>> indent(s, ' ') ' hello\n\n \n world' The optional predicate argument can be used to control which lines are indented. For example, it is easy to add prefix to eve

textwrap.shorten()

textwrap.shorten(text, width, **kwargs) Collapse and truncate the given text to fit in the given width. First the whitespace in text is collapsed (all whitespace is replaced by single spaces). If the result fits in the width, it is returned. Otherwise, enough words are dropped from the end so that the remaining words plus the placeholder fit within width: >>> textwrap.shorten("Hello world!", width=12) 'Hello world!' >>> textwrap.shorten("Hello world!", width=11) 'Hello [.

textwrap.TextWrapper.break_long_words

break_long_words (default: True) If true, then words longer than width will be broken in order to ensure that no lines are longer than width. If it is false, long words will not be broken, and some lines may be longer than width. (Long words will be put on a line by themselves, in order to minimize the amount by which width is exceeded.)

textwrap.TextWrapper.break_on_hyphens

break_on_hyphens (default: True) If true, wrapping will occur preferably on whitespaces and right after hyphens in compound words, as it is customary in English. If false, only whitespaces will be considered as potentially good places for line breaks, but you need to set break_long_words to false if you want truly insecable words. Default behaviour in previous versions was to always allow breaking hyphenated words.

textwrap.TextWrapper.drop_whitespace

drop_whitespace (default: True) If true, whitespace at the beginning and ending of every line (after wrapping but before indenting) is dropped. Whitespace at the beginning of the paragraph, however, is not dropped if non-whitespace follows it. If whitespace being dropped takes up an entire line, the whole line is dropped.

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.

test.support.verbose

test.support.verbose True when verbose output is enabled. Should be checked when more detailed information is desired about a running test. verbose is set by test.regrtest.

test.support.TestFailed

exception test.support.TestFailed Exception to be raised when a test fails. This is deprecated in favor of unittest-based tests and unittest.TestCase‘s assertion methods.

test.support.WarningsRecorder

class test.support.WarningsRecorder Class used to record warnings for unit tests. See documentation of check_warnings() above for more details.

textwrap.fill()

textwrap.fill(text, width=70, **kwargs) Wraps the single paragraph in text, and returns a single string containing the wrapped paragraph. fill() is shorthand for "\n".join(wrap(text, ...)) In particular, fill() accepts exactly the same keyword arguments as wrap().