标签:
set是一个无序且不重复的元素集合
1 class set(object): 2 """ 3 set() -> new empty set object 4 set(iterable) -> new set object 5 6 Build an unordered collection of unique elements. 7 打造唯一元素的无序集合 8 """ 9 def add(self, *args, **kwargs): # real signature unknown 10 """ 11 Add an element to a set. 12 增加一个元素到集合 13 eg: 14 s1 = set([1,2,3]) 15 s1.add(4) 16 17 This has no effect if the element is already present. 18 19 """ 20 pass 21 22 def clear(self, *args, **kwargs): # real signature unknown 23 """ Remove all elements from this set. """ 24 移除集合中所有元素 25 pass 26 27 def copy(self, *args, **kwargs): # real signature unknown 28 """ Return a shallow copy of a set. """ 29 浅拷贝 30 pass 31 32 def difference(self, *args, **kwargs): # real signature unknown 33 """ 34 Return the difference of two or more sets as a new set. 35 返回两个或多个集合的不同为一个新的集合 36 eg: 37 old_dict = set([1,2,3,4,5,6,7]) 38 # cmdb 新汇报的数据 39 new_dict = set([5,6,7,8,9]) 40 now_dict = set([5,6,7,1,0]) 41 print(old_dict.difference(new_dict,now_dict)) 42 (i.e. all elements that are in this set but not the others.) 43 """ 44 pass 45 46 def difference_update(self, *args, **kwargs): # real signature unknown 47 """ Remove all elements of another set from this set. 48 从当前集合中移除另一集合的所有元素,当前集合被改变 49 eg: 50 old_dict = set([1,2,3,4,5,6,7]) 51 # cmdb 新汇报的数据 52 new_dict = set([5,6,7,8,9]) 53 old_dict.difference_update(new_dict) 54 print(old_dict) 55 """ 56 pass 57 58 def discard(self, *args, **kwargs): # real signature unknown 59 """ 60 Remove an element from a set if it is a member. 61 移除一个集合的中一个元素,如果没有则什么都不做 62 If the element is not a member, do nothing. 63 """ 64 pass 65 66 def intersection(self, *args, **kwargs): # real signature unknown 67 """ 68 Return the intersection of two sets as a new set. 69 返回两个集合的交集为一个新的集合 70 (i.e. all elements that are in both sets.) 71 """ 72 pass 73 74 def intersection_update(self, *args, **kwargs): # real signature unknown 75 """ Update a set with the intersection of itself and another. 76 更新一个集合,使用它和另一集合的交集 77 eg: 78 old_dict = set([1,2,3,4,5]) 79 new_dict = set([4,5,6,7,8]) 80 print(old_dict) 81 """ 82 pass 83 84 def isdisjoint(self, *args, **kwargs): # real signature unknown 85 """ Return True if two sets have a null intersection. 86 如果两个集合没有交集则返回真 87 """ 88 pass 89 90 def issubset(self, *args, **kwargs): # real signature unknown 91 """ Report whether another set contains this set. 92 如果此集合包含在另一集合中,则返回真 93 eg: 94 old_dict = set([1,2,3,4,5,6,7,8]) 95 # cmdb 新汇报的数据 96 new_dict = set([5,6,7,8]) 97 print(new_dict.issubset(old_dict)) 98 """ 99 pass 100 101 def issuperset(self, *args, **kwargs): # real signature unknown 102 """ Report whether this set contains another set. 103 此集合包含另一集合则返回真 104 old_dict = set([1,2,3,4,5,6,7,8]) 105 # cmdb 新汇报的数据 106 new_dict = set([5,6,7,8]) 107 print(old_dict.issuperset(new_dict)) 108 """ 109 pass 110 111 def pop(self, *args, **kwargs): # real signature unknown 112 """ 113 Remove and return an arbitrary set element. 114 Raises KeyError if the set is empty. 115 随机移除集合中的一个元素 116 eg: 117 old_dict = set([1,2,3,4,5,6,7,8]) 118 print(old_dict.pop()) 119 """ 120 pass 121 122 def remove(self, *args, **kwargs): # real signature unknown 123 """ 124 Remove an element from a set; it must be a member. 125 移出集合中的一个元素,如果元素不存在则报错 126 If the element is not a member, raise a KeyError. 127 """ 128 pass 129 130 def symmetric_difference(self, *args, **kwargs): # real signature unknown 131 """ 132 Return the symmetric difference of two sets as a new set. 133 (i.e. all elements that are in exactly one of the sets.) 134 """ 135 pass 136 137 def symmetric_difference_update(self, *args, **kwargs): # real signature unknown 138 """ Update a set with the symmetric difference of itself and another. """ 139 pass 140 141 def union(self, *args, **kwargs): # real signature unknown 142 """ 143 Return the union of sets as a new set. 144 返回两个集合的合集为一个新的集合 145 (i.e. all elements that are in either set.) 146 """ 147 pass 148 149 def update(self, *args, **kwargs): # real signature unknown 150 """ Update a set with the union of itself and others. 151 更新此集合,使用此集合与另一集合的合集 152 """ 153 pass 154 155 def __and__(self, *args, **kwargs): # real signature unknown 156 """ Return self&value. """ 157 pass 158 159 def __contains__(self, y): # real signature unknown; restored from __doc__ 160 """ x.__contains__(y) <==> y in x. """ 161 pass 162 163 def __eq__(self, *args, **kwargs): # real signature unknown 164 """ Return self==value. """ 165 pass 166 167 def __getattribute__(self, *args, **kwargs): # real signature unknown 168 """ Return getattr(self, name). """ 169 pass 170 171 def __ge__(self, *args, **kwargs): # real signature unknown 172 """ 173 __ge__=($self, value, /) 174 -- 175 176 Return self>=value. 177 """ 178 pass 179 180 def __gt__(self, *args, **kwargs): # real signature unknown 181 """ Return self>value. """ 182 pass 183 184 def __iand__(self, *args, **kwargs): # real signature unknown 185 """ Return self&=value. """ 186 pass 187 188 def __init__(self, seq=()): # known special case of set.__init__ 189 """ 190 set() -> new empty set object 191 set(iterable) -> new set object 192 193 Build an unordered collection of unique elements. 194 # (copied from class doc) 195 """ 196 pass 197 198 def __ior__(self, *args, **kwargs): # real signature unknown 199 """ Return self|=value. """ 200 pass 201 202 def __isub__(self, *args, **kwargs): # real signature unknown 203 """ Return self-=value. """ 204 pass 205 206 def __iter__(self, *args, **kwargs): # real signature unknown 207 """ Implement iter(self). """ 208 pass 209 210 def __ixor__(self, *args, **kwargs): # real signature unknown 211 """ Return self^=value. """ 212 pass 213 214 def __len__(self, *args, **kwargs): # real signature unknown 215 """ Return len(self). """ 216 pass 217 218 def __le__(self, *args, **kwargs): # real signature unknown 219 """ Return self<=value. """ 220 pass 221 222 def __lt__(self, *args, **kwargs): # real signature unknown 223 """ Return self<value. """ 224 pass 225 226 @staticmethod # known case of __new__ 227 def __new__(*args, **kwargs): # real signature unknown 228 """ Create and return a new object. See help(type) for accurate signature. """ 229 pass 230 231 def __ne__(self, *args, **kwargs): # real signature unknown 232 """ Return self!=value. """ 233 pass 234 235 def __or__(self, *args, **kwargs): # real signature unknown 236 """ Return self|value. """ 237 pass 238 239 def __rand__(self, *args, **kwargs): # real signature unknown 240 """ Return value&self. """ 241 pass 242 243 def __reduce__(self, *args, **kwargs): # real signature unknown 244 """ Return state information for pickling. """ 245 pass 246 247 def __repr__(self, *args, **kwargs): # real signature unknown 248 """ Return repr(self). """ 249 pass 250 251 def __ror__(self, *args, **kwargs): # real signature unknown 252 """ Return value|self. """ 253 pass 254 255 def __rsub__(self, *args, **kwargs): # real signature unknown 256 """ Return value-self. """ 257 pass 258 259 def __rxor__(self, *args, **kwargs): # real signature unknown 260 """ Return value^self. """ 261 pass 262 263 def __sizeof__(self): # real signature unknown; restored from __doc__ 264 """ S.__sizeof__() -> size of S in memory, in bytes """ 265 pass 266 267 def __sub__(self, *args, **kwargs): # real signature unknown 268 """ Return self-value. """ 269 pass 270 271 def __xor__(self, *args, **kwargs): # real signature unknown 272 """ Return self^value. """ 273 pass
标签:
原文地址:http://www.cnblogs.com/kongzhagen/p/5451615.html