Skip to content

Instantly share code, notes, and snippets.

@tylerharper
Created January 5, 2010 02:16
Show Gist options
  • Save tylerharper/269083 to your computer and use it in GitHub Desktop.
Save tylerharper/269083 to your computer and use it in GitHub Desktop.
output = ''
for line in text.split('\n'):
while len(line) > 80:
pos = line[:80].rfind(' ')
output = output + line[:pos] + '\n'
line = line[pos+1:]
output = output + line + '\n'
print output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment