可以使用以下方法删除列表中的重复值:
original_list = [1, 2, 3, 3, 4, 5, 5]
unique_list = list(set(original_list))
print(unique_list)
original_list = [1, 2, 3, 3, 4, 5, 5]
unique_list = []
[unique_list.append(x) for x in original_list if x not in unique_list]
print(unique_list)
from collections import Counter
original_list = [1, 2, 3, 3, 4, 5, 5]
counter = Counter(original_list)
unique_list = [key for key, value in counter.items() if value == 1]
print(unique_list)
辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读: python中输出不换行的方法是什么