1text = "hello, this is some text to break up, with some reeeeeeeeeaaaaaaally long words."
2n = 16
3
4words = iter(text.split())
5lines, current = [], next(words)
6for word in words:
7 if len(current) + 1 + len(word) > n:
8 lines.append(current)
9 current = word
10 else:
11 current += " " + word
12lines.append(current)
13