Skip to content

Instantly share code, notes, and snippets.

@arafatamim
Created June 30, 2019 08:53
Show Gist options
  • Save arafatamim/2df2e8d2f8e1d50b18ebe7c391d6d46c to your computer and use it in GitHub Desktop.
Save arafatamim/2df2e8d2f8e1d50b18ebe7c391d6d46c to your computer and use it in GitHub Desktop.
Python method to wrap text in box
def boxit(input, borderStyle="-", tl="+", tr="+", bl="+", br="+"):
line1 = tl + borderStyle * (len(input)+2) + tr
line2 = "| " + input + " |"
line3 = bl + borderStyle * (len(input)+2) + br
result = '''{0}
{1}
{2}'''.format(line1, line2, line3)
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment