def clearlist(mass,out=[]): for qwe in mass: if (type(qwe)==list): out.append(clearlist(qwe)) else: if not(qwe in out): out.append(qwe) return(out)
w=[1,2,3,4,1,1,23,12,12,21] w=clearlist(w)
[1, 2, 3, 4, 23, 12, 21]
w=[1,2,3,4,1,1,23,12,12,21,['a','a','s']] [1, 2, 3, 4, 23, 12, 21, 'a', 's', [...]]