Guido van Rossum added the comment: Use .splitlines() to break the input into lines, wrap each "line" separately, and join again? __________________________________ Tracker <report at bugs.python.org> <http://bugs.python.org/issue1859> __________________________________