list1=['f','l','a','m','e','s'] #This is the predefined list
list2=['e','e','f','a','s','a'] #This is the list with repitition
x=list(set(list2)) # I want to remove duplicates
print(x)
Here I want the variable x
to retain the order which list1
has. For example, if at one instance set(list2)
produces the output as ['e','f','a','s']
, I want it to produce ['f','a','e','s']
(Just by following the order of list1
).
Can anyone help me with this?