Python podzielony sprytne zapętlanie
text = "hello, this is some text to break up, with some reeeeeeeeeaaaaaaally long words."
n = 16
words = iter(text.split())
lines, current = [], next(words)
for word in words:
if len(current) + 1 + len(word) > n:
lines.append(current)
current = word
else:
current += " " + word
lines.append(current)
Tense Trout