英文文檔: 2. 不傳入參數時,生成的空的不可變集合。 ...
英文文檔:
- class
frozenset
([iterable]) - Return a new
frozenset
object, optionally with elements taken from iterable.frozenset
is a built-in class. Seefrozenset
and Set Types — set, frozenset for documentation about this class. - For other containers see the built-in
set
,list
,tuple
, anddict
classes, as well as thecollections
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. 不傳入參數時,生成的空的不可變集合。
>>> c = frozenset() >>> c frozenset()