On this page
textwrap.fill
Prev: textwrap.dedent | Up: textwrap | Next: textwrap.indent
Rel: textwrap.dedent, textwrap.indent, textwrap.shorten, textwrap.TextWrapper
Ref: docs.python.org — textwrap.fill
Tags: #public #python3 #stdlib #textwrap
Import
import textwrap
from textwrap import fill
Signature & Overview
textwrap.fill(text, width=70, **kwargs)
Fill a single paragraph of text, returning a new string.
Usage
import textwrap
assert textwrap.fill('hello world again', width=11) == 'hello world\nagain'
Gotchas
- Shorthand for
'\n'.join(textwrap.wrap(...)).
REPL Inspect
from textwrap import fill
help(fill)
Linked from
Related notes
- tuts/python3/stdlib_module/textwrap/dedent Linked here; links to this page; shared tags: #stdlib, #textwrap
- tuts/python3/stdlib_module/textwrap/indent Linked here; links to this page; shared tags: #stdlib, #textwrap
- tuts/python3/stdlib_module/textwrap/shorten Linked here; links to this page; shared tags: #stdlib, #textwrap
- tuts/python3/stdlib_module/textwrap/TextWrapper Linked here; links to this page; shared tags: #stdlib, #textwrap
- tuts/python3/stdlib_module/textwrap Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/textwrap/wrap links to this page; shared tags: #stdlib, #textwrap
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib
- tuts/c/stdlib/assert/static_assert shared tags: #stdlib