def split_by_n(seq, n):
    """A generator to divide a sequence into chunks of n units."""
while seq:
    yield seq[:n]
seq = seq[n:]
print(list(split_by_n('1234567890', 2)))
Split python string every nth character?