【发布时间】:2011-08-21 08:06:32
【问题描述】:
我正在尝试用 Python 制作一组集合。我不知道该怎么做。
从空集xx开始:
xx = set([])
# Now we have some other set, for example
elements = set([2,3,4])
xx.add(elements)
但我明白了
TypeError: unhashable type: 'list'
或
TypeError: unhashable type: 'set'
在 Python 中可以有一组集合吗?
我正在处理大量集合,并且我希望能够不必处理重复的集合(集合 A1、A2、...的集合 B,如果 Ai = Aj)
【问题讨论】:
标签: python collections nested set