Skip to content

Instantly share code, notes, and snippets.

@ninijay
Created September 20, 2016 17:54
Show Gist options
  • Save ninijay/6191b6c6470e7817b9553a861079c479 to your computer and use it in GitHub Desktop.
Save ninijay/6191b6c6470e7817b9553a861079c479 to your computer and use it in GitHub Desktop.
textwrap shorten created by ninijay - https://repl.it/DdpX/1
import textwrap
# standard Paragraph
# width = 12
para = "Hello World!"
print("Normal Paragraph:\n" + para + "\n")
# shorten
print("textwrap.shorten(width -> 12) Paragraph:\n" + textwrap.shorten(para, width=12))
print("textwrap.shorten(width -> 11) Paragraph:\n" + textwrap.shorten(para, width=11))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment