python基本数据类型之tuple
tuple: 元组
基本操作:
-
- 索引
- 切片
- 循环
- 长度
- 包含
1 #!/usr/bin/env python 2 # -*- coding: utf-8 -*- 3 4 """ 基本数据类型之tuple """ 5 6 dict 7 class tuple(object): 8 """ 9 tuple() -> empty tuple 10 tuple(iterable) -> tuple initialized from iterable's items 11 12 If the argument is a tuple, the return value is the same object. 13 """ 14 15 def count(self, value): # real signature unknown; restored from __doc__ 16 """ 返回子序列出现的次数 """ 17 """ T.count(value) -> integer -- return number of occurrences of value """ 18 return 0 19 20 def index(self, value, start=None, stop=None): # real signature unknown; restored from __doc__ 21 """ 返回子序列的索引值,如果子序列不存在就报错ValueError start是开始位置,end是结束位置 """ 22 """ 23 T.index(value, [start, [stop]]) -> integer -- return first index of value. 24 Raises ValueError if the value is not present. 25 """ 26 return 0 27 28 def __add__(self, *args, **kwargs): # real signature unknown 29 """ Return self+value. """ 30 pass 31 32 def __contains__(self, *args, **kwargs): # real signature unknown 33 """ Return key in self. """ 34 pass 35 36 def __eq__(self, *args, **kwargs): # real signature unknown 37 """ Return self==value. """ 38 pass 39 40 def __getattribute__(self, *args, **kwargs): # real signature unknown 41 """ Return getattr(self, name). """ 42 pass 43 44 def __getitem__(self, *args, **kwargs): # real signature unknown 45 """ Return self[key]. """ 46 pass 47 48 def __getnewargs__(self, *args, **kwargs): # real signature unknown 49 pass 50 51 def __ge__(self, *args, **kwargs): # real signature unknown 52 """ Return self>=value. """ 53 pass 54 55 def __gt__(self, *args, **kwargs): # real signature unknown 56 """ Return self>value. """ 57 pass 58 59 def __hash__(self, *args, **kwargs): # real signature unknown 60 """ Return hash(self). """ 61 pass 62 63 def __init__(self, seq=()): # known special case of tuple.__init__ 64 """ 65 tuple() -> empty tuple 66 tuple(iterable) -> tuple initialized from iterable's items 67 68 If the argument is a tuple, the return value is the same object. 69 # (copied from class doc) 70 """ 71 pass 72 73 def __iter__(self, *args, **kwargs): # real signature unknown 74 """ Implement iter(self). """ 75 pass 76 77 def __len__(self, *args, **kwargs): # real signature unknown 78 """ Return len(self). """ 79 pass 80 81 def __le__(self, *args, **kwargs): # real signature unknown 82 """ Return self<=value. """ 83 pass 84 85 def __lt__(self, *args, **kwargs): # real signature unknown 86 """ Return self<value. """ 87 pass 88 89 def __mul__(self, *args, **kwargs): # real signature unknown 90 """ Return self*value.n """ 91 pass 92 93 @staticmethod # known case of __new__ 94 def __new__(*args, **kwargs): # real signature unknown 95 """ Create and return a new object. See help(type) for accurate signature. """ 96 pass 97 98 def __ne__(self, *args, **kwargs): # real signature unknown 99 """ Return self!=value. """ 100 pass 101 102 def __repr__(self, *args, **kwargs): # real signature unknown 103 """ Return repr(self). """ 104 pass 105 106 def __rmul__(self, *args, **kwargs): # real signature unknown 107 """ Return self*value. """ 108 pass

浙公网安备 33010602011771号