# option 1: string slices
def get_slices_str(n, sizes, n_digits=11):
    s = f'{n:0{n_digits}}'
    prev = 0
    for size in sizes:
        yield s[prev : prev + size]
        prev += size

# option 2: math
def get_slices_int(n, sizes, n_digits=11):
    for size in sizes:
        n_digits -= size
        val, n = divmod(n, 10 ** n_digits)
        yield f'{val:0{size}}'

from timeit import timeit
from random import sample

# generate a sample with 1000 random numbers between 0 and 999999
numbers = sample(range(1000000), 1000)
# execute each test 300 times
params = { 'number' : 300, 'globals': globals() }
sizes = [2, 2, 1, 3, 3]
# execution times are in seconds
print(timeit('for n in numbers:\n  " ".join(get_slices_str(n, sizes))', **params))
print(timeit('for n in numbers:\n  " ".join(get_slices_int(n, sizes))', **params))
