How to find the best solution ?

Tim Golden mail at timgolden.me.uk
Tue Mar 23 06:54:33 EDT 2010


On 23/03/2010 10:48, Johny wrote:
> I have a text and would like  to split the text into smaller parts,
> say into 100 characters each. But if  the 100th character is not a
> blank ( but word) this must be less than 100 character.That means the
> word itself can not be split.
> These smaller parts must contains only whole( not split) words.
> I was thinking  about  RegEx but do not know how to find the correct
> Regular Expression.
> Can anyone help?
> Thanks
> L.

Have a look at the textwrap module

TJG



More information about the Python-list mailing list