Unhashable type: 'list' error in python

Viewed 3359

I have this dictionary:

final = {0: [1, 9], 1: [0, 9], 8: [16, 10], 9: [0, 1], 10: [8, 16], 16: [8, 10]}

And I wanted to convert it to a list, so I used list comprehensions and the result was the following:

myList = [[int(k)]+v for k, v in final.items()]
myList = [[0, 1, 9], [0, 1, 9], [0, 1, 9], [8, 10, 16], [8, 10, 16], [8, 10, 16]]

I also wanted the whole list as well as the elements inside of every small list to be sorted and to erase the duplicates from the list:

for i in myList:
   i.sort()

myList.sort()
list(set(myList))
print(myList)

However, when I run this i get the error "Unhashable type: 'list' ". Is there any other way to implement this? Thank you in advance!

5 Answers
Related