[issue26214] textwrap should minimize number of breaks in extra long words

Irit Katriel report at bugs.python.org
Fri Sep 4 10:21:48 EDT 2020


Irit Katriel <iritkatriel at yahoo.com> added the comment:

You can do this already with the break_long_words arg of testwrap:

>>> import itertools, textwrap
>>> wr = textwrap.wrap
>>> list(itertools.chain(*(wr(x, 5) for x in wr("123 123 1234567", width=5, break_long_words=False))))
['123', '123', '12345', '67']

----------
nosy: +iritkatriel

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue26214>
_______________________________________


More information about the Python-bugs-list mailing list