Popular recipes by Mike Brown http://code.activestate.com/recipes/users/666241/2004-10-12T22:20:09-07:00ActiveState Code Recipesone-liner word-wrap function (Python)
2004-10-12T22:20:09-07:00Mike Brownhttp://code.activestate.com/recipes/users/666241/http://code.activestate.com/recipes/148061-one-liner-word-wrap-function/
<p style="color: grey">
Python
recipe 148061
by <a href="/recipes/users/666241/">Mike Brown</a>
(<a href="/recipes/tags/text/">text</a>).
Revision 6.
</p>
<p>This word-wrap function flows paragraphs of text so they fit in a certain column width. It differs from similar methods in that it preserves existing whitespace such as newlines and runs of spaces.</p>