I have a list as UEID = ['0','0 1 ','0 1 2','0 1 2 3'] need an output as ['0',['0','1'],...] or UEID[1][1] should print 1 : My code:

for x in UEID:

    if " " in UEID[x]:

        ueid_list = [int(j) for j in UEID[x]]

        print ueid_list

This is showing an error as:
TypeError: list indices must be in integer, not str