Python 内建函数 - frozenset([iterable])

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集合元素必须可哈希
  • 不可变性

拓展阅读

frozenset和Set类型 — set, frozenset

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值