标签:nbsp classes 英文 intern for 对象 集合 module with
英文文档:
set([iterable])set object, optionally with elements taken from iterable. set is a built-in class. See set and Set Types — set, frozenset for documentation about this class.frozenset, list, tuple, and dict classes, as well as the collections module.说明:
1. 传入一个可迭代对象,生成一个新的集合。
>>> a = set(range(10)) >>> a {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
2. 不传入参数时,生成一个新的空集合。
>>> a = set() >>> a set()
3. 返回的集合是可以修改的。
>>> a = set() >>> a set() >>> a.add(1) >>> a {1}
标签:nbsp classes 英文 intern for 对象 集合 module with
原文地址:http://www.cnblogs.com/sesshoumaru/p/6063843.html