可以使用以下方法刪除列表中相同的內(nèi)容:
my_list = [1, 2, 3, 1, 2, 3]
my_list = list(set(my_list))
print(my_list)
my_list = [1, 2, 3, 1, 2, 3]
my_list = list(dict.fromkeys(my_list))
print(my_list)
my_list = [1, 2, 3, 1, 2, 3]
new_list = []
for item in my_list:
if item not in new_list:
new_list.append(item)
print(new_list)
以上是幾種常用的方法,可以根據(jù)具體情況選擇合適的方法。