def wrap(s, l):
    r = 10 - len(l[-1]) if l else 0
if r > 0:
    l[-1] += s[:r]
for i in range(r, len(s), 10):
    l.append(s[i:i + 10])
return l
l = ['12345678', '123456789']
print(wrap('a', l))
print(wrap('123456789123456789123', l))
Python - Wrap text in list