I am looking for a way to truncate a string in Python that will not cut off the string in the middle of a word.
For example:
Original: \"This is
>>> import textwrap >>> textwrap.wrap('The quick brown fox jumps over the lazy dog', 12) ['The quick', 'brown fox', 'jumps over', 'the lazy dog']
You just take the first element of that and you're done...