Python內(nèi)置frozenset函數(shù)的詳細(xì)介紹
來源:懂視網(wǎng)
責(zé)編:小采
時間:2020-11-27 14:25:08
Python內(nèi)置frozenset函數(shù)的詳細(xì)介紹
Python內(nèi)置frozenset函數(shù)的詳細(xì)介紹:英文文檔:class frozenset([iterable])Return a new frozenset object, optionally with elements taken from iterable. frozenset is a built-in class. See frozenset and Set Types — set, fr
導(dǎo)讀Python內(nèi)置frozenset函數(shù)的詳細(xì)介紹:英文文檔:class frozenset([iterable])Return a new frozenset object, optionally with elements taken from iterable. frozenset is a built-in class. See frozenset and Set Types — set, fr
英文文檔:
class frozenset
([iterable])
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.
說明:
1. 傳入一個可迭代對象,生成一個新的不可變集合。
>>> a = frozenset(range(10))
>>> a
frozenset({0, 1, 2, 3, 4, 5, 6, 7, 8, 9})
>>> b = frozenset('I am a Pythoner')
>>> b
frozenset({'y', 'I', ' ', 'r', 't', 'm', 'h', 'o', 'a', 'e', 'n', 'P'})
2. 不傳入?yún)?shù)時,生成的空的不可變集合。
>>> c = frozenset()
>>> c
frozenset()
聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com
Python內(nèi)置frozenset函數(shù)的詳細(xì)介紹
Python內(nèi)置frozenset函數(shù)的詳細(xì)介紹:英文文檔:class frozenset([iterable])Return a new frozenset object, optionally with elements taken from iterable. frozenset is a built-in class. See frozenset and Set Types — set, fr