def append(L, idx, item):
    while len(L) <= idx:
        L.append([])
L[idx].append(item)
for i in range(x):
    for j in someListOfElements:
        append(result, i, j)
How to create a list or tuple of empty lists in Python?