📝 Edit page
➕ Add page
Truncate
Truncate long strings.
import textwrap
textwrap.shorten("Hello world!", width=12)
# => 'Hello world!'
textwrap.shorten("Hello world!", width=11)
# > 'Hello [...]'
textwrap.shorten("Hello world", width=10, placeholder="...")
# => 'Hello...'
'{:.5}'.format('xylophone')
# => 'xylop'