strin = ['cc', 'bbbb', 'afa', 'sss', 'bbbb', 'cc', 'shafa'] strset =list(set(strin)) print(strset) strset.sort(key=strin.index) print(strset)