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集合元素必须可哈希
- 不可变性
本文介绍了Python内置类frozenset的基本用法,包括如何创建一个frozenset对象及其实例演示。此外还强调了frozenset集合元素必须可哈希的特点,并指出其不可变性。

260

被折叠的 条评论
为什么被折叠?



