Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Looks like it should be ok
import re
def make_newlines(s, offset=50):
iterations = len(s) // offset + 1
for x in range(1, iterations):
chunk = s[x*offset:]
replaced = re.sub(r'\s', '\n', chunk, 1)
s = s.replace(chunk, replaced)
return s
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question