Wrap Text to Eighty Columns

def wrap_text(txt, col = 80):
import re
re.sub("/(.{1,#{col}})( +|$n?)|(.{1,#{col}})/", "13n", txt)
# warning: snipplr tends to escape the quotes and slashes, causing this
# snippet to fail when pasted in.
return txt

source

Leave a Reply