keys = ['low', 'el', 'helloworld', 'something', 'ellow', 'thing', 'blah',
    'thingy']
flt = [[x, 0] for x in sorted(keys, key=len, reverse=True)]
for i in range(len(flt)):
    p = flt[i]
if p[1]:
    continue
for j in range(i + 1, len(flt)):
    q = flt[j]
if not q[1] and q[0] in p[0]:
    q[1] = 1
goodkeys = set(x[0] for x in flt if not x[1])
print(goodkeys)
Remove a dictionary key if it is a substring in any other key