frozenset 创建不可变集合
内置函数(类)frozenset,Python 官方文档描述如下:
help(frozenset)
Help on class frozenset in module builtins:
class frozenset(object)
| frozenset() -> empty frozenset object
| frozenset(iterable) -> frozenset object
|
| Build an immutable unordered collection of unique elements.
|
将可迭代对象转换为集合,返回一个新的 frozenset 集合对象。可迭代对象为空,或不传参数,得到一个空集合。
type(frozenset)
type
frozenset()
frozenset()
frozenset([])
frozenset()
frozenset('0123')
frozenset({'0', '1', '2', '3'})
frozenset({'a':1,'b':2})
frozenset({'a', 'b'})