from itertools import combinations

def compositions(s, k):
    n = len(s)
for c in combinations(list(range(1, n)), k - 1):
    yield [s[i:j] for i, j in zip((0,) + c, c + (n,))]
Create possible combinations of specific size