# Create the Dataset
L = []
L.append(["Arthropoda", "Hexapoda", "Insecta", "Coleoptera", "Cerambycidae", "Anaglyptus"])
L.append(["Arthropoda", "Hexapoda", "Insecta", "Coleoptera", "Cerambycidae", "Aromia"])
# Instead of a list of lists, let's have a list of tuples!
L = [tuple(x) for x in L]
# Using a set, we can easily remove duplicates
L = set(L)
正如在注释中提到的,元组是可散列的,即使列表不是。所以让我们将您的行转换为元组!你知道吗
Python大师可能会被冒犯,但这个答案值得一试
相关问题 更多 >
编程相关推荐