[Tutor] how to understand unhashable type: 'list'

lina lina.lastname at gmail.com
Thu Nov 17 10:59:14 CET 2011


list1
[['61', '34', '61', '34'], ['61', '35', '61', '70', '61'], ['61',
'70', '61', '34'], ['34', '58', '34', '58']]
>>> weight={}
>>> weight{list1[0]}=1
SyntaxError: invalid syntax
>>> weight[list1[0]]=1

Traceback (most recent call last):
  File "<pyshell#292>", line 1, in <module>
    weight[list1[0]]=1
TypeError: unhashable type: 'list'
>>>

I wonder how to count the occurence of the list of lists.

Thanks, ^_^


More information about the Tutor mailing list