代码示例:(标识:python_howto_remove_duplicates_2)
python_howto_remove_duplicates_2.py
def my_function(x):
  return list(dict.fromkeys(x))

mylist = my_function(["a", "b", "a", "c", "c"])

print(mylist)
运行结果: