这是我的代码。
a = [
['StarList', 'StarId38', 'ShipList']
]
b = [
['StarList', 'StarId3', 'ShipList'],
['StarList', 'StarId4', 'ShipList']
]
assert set(a) == set(b) # False
a = [
['StarList', 'StarId4', 'ShipList'],
['StarList', 'StarId3', 'ShipList']
]
assert set(a) == set(b) # True
它不起作用:
Traceback (most recent call last):
File "compare.py", line 8, in <module>
assert set(a) == set(b) # False
TypeError: unhashable type: 'list'
那么,怎么做呢?