1. 元组
1. 定义
class tuple(object):
"""
tuple() -> empty tuple
tuple(iterable) -> tuple initialized from iterable's items
If the argument is a tuple, the return value is the same object.
"""
- 如果没有参数,则定义一个空元组。
- 如果参数是一个可迭代对象,则元组初始化为可迭代对象的内容。
- 如果参数是一个元组,则返回值是同一个对象。
2. 方法
1. count(self, value)
def count(self, value): # real signature unknown; restored from __doc__
""" T.count(value) -> integer -- return number of occurrences of value """
return 0
返回值出现的次数。
2. index(self, value, start=None, stop=None)
def index(self, value, start=None, stop=None): # real signature unknown; restored from __doc__
"""
T.index(value, [start, [stop]]) -> integer -- return first index of value.
Raises ValueError if the value is not present.
"""
return 0
返回值第一次出现的索引。
2. 集合
1. 定义
class set(object):
"""
set() -> new empty set object
set(iterable) -> new set object
Build an unordered collection of unique elements.
"""
2. 方法
1. add(self, *args, **kwargs)
def add(self, *args, **kwargs): # real signature unknown
"""
Add an element to a set.
This has no effect if the element is already present.
"""
pass
- 在集合中添加一个元素。
- 如果集合中已存在该元素则无影响(集合中的元素不能重复)。
2. clear(self, *args, **kwargs)
def clear(self, *args, **kwargs): # real signature unknown
""" Remove all elements from this set. """
pass
清空集合中的元素。
3. copy(self, *args, **kwargs)
def copy(self, *args, **kwargs): # real signature unknown
""" Return a shallow copy of a set. """
pass
返回一个浅拷贝副本。
4. difference(self, *args, **kwargs)
def difference(self, *args, **kwargs): # real signature unknown
"""
Return the difference of two or more sets as a new set.
(i.e. all elements that are in this set but not the others.)
"""
pass
5. difference_update(self, *args, **kwargs)
def difference_update(self, *args, **kwargs): # real signature unknown
""" Remove all elements of another set from this set. """
pass
6. discard(self, *args, **kwargs)
def discard(self, *args, **kwargs): # real signature unknown
"""
Remove an element from a set if it is a member.
If the element is not a member, do nothing.
"""
pass
7. intersection(self, *args, **kwargs)
def intersection(self, *args, **kwargs): # real signature unknown
"""
Return the intersection of two sets as a new set.
(i.e. all elements that are in both sets.)
"""
pass
8. intersection_update(self, *args, **kwargs)
def intersection_update(self, *args, **kwargs): # real signature unknown
""" Update a set with the intersection of itself and another. """
pass
9. pop(self, *args, **kwargs)
def pop(self, *args, **kwargs): # real signature unknown
"""
Remove and return an arbitrary set element.
Raises KeyError if the set is empty.
"""
pass
10. remove(self, *args, **kwargs)
def remove(self, *args, **kwargs): # real signature unknown
"""
Remove an element from a set; it must be a member.
If the element is not a member, raise a KeyError.
"""
pass
11. union(self, *args, **kwargs)
def union(self, *args, **kwargs): # real signature unknown
"""
Return the union of sets as a new set.
(i.e. all elements that are in either set.)
"""
pass
12. update(self, *args, **kwargs)
def update(self, *args, **kwargs): # real signature unknown
""" Update a set with the union of itself and others. """
pass
3. 字典
1. 定义
class dict(object):
"""
dict() -> new empty dictionary
dict(mapping) -> new dictionary initialized from a mapping object's
(key, value) pairs
dict(iterable) -> new dictionary initialized as if via:
d = {}
for k, v in iterable:
d[k] = v
dict(**kwargs) -> new dictionary initialized with the name=value pairs
in the keyword argument list. For example: dict(one=1, two=2)
"""
2. 方法
1. clear(self)
def clear(self): # real signature unknown; restored from __doc__
""" D.clear() -> None. Remove all items from D. """
pass
2. copy(self)
def copy(self): # real signature unknown; restored from __doc__
""" D.copy() -> a shallow copy of D """
pass
3. fromkeys(*args, **kwargs)
def fromkeys(*args, **kwargs): # real signature unknown
""" Returns a new dict with keys from iterable and values equal to value. """
pass
4. get(self, k, d=None)
def get(self, k, d=None): # real signature unknown; restored from __doc__
""" D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None. """
pass
5. items(self)
def items(self): # real signature unknown; restored from __doc__
""" D.items() -> a set-like object providing a view on D's items """
pass
6. keys(self)
def keys(self): # real signature unknown; restored from __doc__
""" D.keys() -> a set-like object providing a view on D's keys """
pass
7. pop(self, k, d=None)
def pop(self, k, d=None): # real signature unknown; restored from __doc__
"""
D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised
"""
pass
8. popitem(self)
def popitem(self): # real signature unknown; restored from __doc__
"""
D.popitem() -> (k, v), remove and return some (key, value) pair as a
2-tuple; but raise KeyError if D is empty.
"""
pass
9. setdefault(self, k, d=None)
def setdefault(self, k, d=None): # real signature unknown; restored from __doc__
""" D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D """
pass
10. update(self, E=None, **F)
def update(self, E=None, **F): # known special case of dict.update
"""
D.update([E, ]**F) -> None. Update D from dict/iterable E and F.
If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
In either case, this is followed by: for k in F: D[k] = F[k]
"""
pass
11. values(self)
def values(self): # real signature unknown; restored from __doc__
""" D.values() -> an object providing a view on D's values """
pass