你好python for后去重
你好,可以使用set()函数去重,例如:
my_list = [1, 2, 3, 3, 4, 4, 5]
my_set = set(my_list)
for item in my_set:
print(item)
输出结果为:
1
2
3
4
5
原文地址: https://www.cveoy.top/t/topic/eOxX 著作权归作者所有。请勿转载和采集!
安全问答是一个知识全球问答,包含丰富的问答知识
你好,可以使用set()函数去重,例如:
my_list = [1, 2, 3, 3, 4, 4, 5]
my_set = set(my_list)
for item in my_set:
print(item)
输出结果为:
1
2
3
4
5
原文地址: https://www.cveoy.top/t/topic/eOxX 著作权归作者所有。请勿转载和采集!