Manual
Return a new frozenset object, optionally with elements taken from iterable. frozenset is a built-in class. See frozenset and Set Types — set, frozenset for documentation about this class.
For other containers see the built-in set, list, tuple, and dict classes, as well as the collections module.
直译
可根据iterable获得元素,返回一个frozenset对象,frozenset是内建类,详情见frozenset和Set类型 — set, frozenset
实例
>>> a = [1, 1, 2, 3, 5, 7, 2]
>>> fs = frozenset(a)
>>> fs
frozenset({1, 2, 3, 5, 7})
Note
- frozenset集合元素必须可哈希
- 不可变性