摘要:
1、 >>> a = {1,2,3} >>> a {1, 2, 3} >>> type(a) <class 'set'> >>> a.add(4) >>> a {1, 2, 3, 4} >>> b = frozenset({1,2,3}) ## 不可变集合 >>> b frozenset({1, 2 阅读全文
摘要:
1、集合单个增加元素 >>> a = {111,222,333,444} >>> a {444, 333, 222, 111} >>> type(a) <class 'set'> >>> a.add(555) >>> a {555, 333, 111, 444, 222} >>> a.add("aa 阅读全文
摘要:
1、直接创建 >>> a = {111,"aaa",222,"bbb",555} >>> a {555, 111, 'aaa', 'bbb', 222} >>> type(a) <class 'set'> 2、字符串转换 >>> a = "helloworld" >>> a 'helloworld' 阅读全文