Recursive way:
def split_str(seq, chunk, skip_tail=False):
lst = []
if chunk <= len(seq):
lst.extend([seq[:chunk]])
lst.extend(split_str(seq[chunk:], chunk, skip_tail))
elif not skip_tail and seq:
lst.extend([seq])
return lst
Demo:
seq = "123456789abcdefghij"
print(split_str(seq, 3))
print(split_str(seq, 3, skip_tail=True))
# ['123', '456', '789', 'abc', 'def', 'ghi', 'j']
# ['123', '456', '789', 'abc', 'def', 'ghi']