主页
Python
如何从 Python 列表中删除重复项
demo_howto_remove_duplicates2
运行 ❯
×
更改方向
保存代码
更改主题
def my_function(x): return list(dict.fromkeys(x)) mylist = my_function(["a", "b", "a", "c", "c"]) print(mylist)
['a', 'b', 'c']