ID EN
Text Wrapping

fill

Python 3.11

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

Syntax

PYTHON
textwrap.fill(text, width=70, *, initial_indent='', subsequent_indent='', expand_tabs=True, replace_whitespace=True, fix_sentence_endings=False, break_long_words=True, drop_whitespace=True, break_on_hyphens=True, tabsize=8, max_lines=None, placeholder=' [...]')

Examples

Example 1
PYTHON
"\n".join(wrap(text, ...))

See Also

fill() fill() wrap()