TypeError : Unhashable type

前端 未结 6 682
灰色年华
灰色年华 2020-11-29 05:45

I am trying to get a list of list of tuples : something like [ [(1,0),(2,0),(3,0)],[(1,1),(2,1),(3,1)....]] I used this statement

set([(a,b)for         


        
6条回答
  •  时光取名叫无心
    2020-11-29 06:36

    The real reason because set does not work is the fact, that it uses the hash function to distinguish different values. This means that sets only allows hashable objects. Why a list is not hashable is already pointed out.

提交回复
热议问题