Revision: 250
Updated Code
at July 6, 2006 13:05 by ndegruchy
Updated Code
def wrap_text(txt, col = 80): import re re.sub("/(.{1,#{col}})( +|$n?)|(.{1,#{col}})/", "\1\3n", txt) # warning: snipplr tends to escape the quotes and slashes, causing this # snippet to fail when pasted in. return txt
Revision: 249
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 6, 2006 11:23 by ndegruchy
Initial Code
def wrap_text(txt, col = 80): import re re.sub(\"/(.{1,#{col}})( +|$n?)|(.{1,#{col}})/\", \"\\1\\3n\", txt) return txt
Initial URL
Initial Description
warning: snipplr tends to escape the quotes and slashes, causing this snippet to fail when pasted verbatim.
Initial Title
Wrap Text to Eighty Columns
Initial Tags
textmate, python, regexp, text
Initial Language
Python