python数据类型详解(三)元祖:tuple

一.基本数据类型

  整数:int
  字符串:str(注:\t等于一个tab键)
  布尔值: bool
  列表:list
  列表用[]
  元祖:tuple
  元祖用()
  字典:dict
注:所有的数据类型都存在想对应的类列里,元祖和列表功能一样,列表可以修改,元祖不能修改。

二.列表所有数据类型:

基本操作:

索引,切片,长度,包含,循环

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.
“””
def count(self, value): # real signature unknown; restored from __doc__
“”” t.count(value) -> integer — return number of occurrences of value “””
(t.count(价值)- >整数,返回值的出现次数)
return 0
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.
“””
(t。指数(价值,[开始,[不要]])- >整数,返回第一索引值。提出了valueerror如果不存在的价值。)
return 0
def __add__(self, *args, **kwargs): # real signature unknown
“”” return self+value. “””
pass
def __contains__(self, *args, **kwargs): # real signature unknown
“”” return key in self. “””
pass
def __eq__(self, *args, **kwargs): # real signature unknown
“”” return self==value. “””
pass
def __getattribute__(self, *args, **kwargs): # real signature unknown
“”” return getattr(self, name). “””
pass
def __getitem__(self, *args, **kwargs): # real signature unknown
“”” return self[key]. “””
pass
def __getnewargs__(self, *args, **kwargs): # real signature unknown
pass
def __ge__(self, *args, **kwargs): # real signature unknown
“”” return self>=value. “””
pass
def __gt__(self, *args, **kwargs): # real signature unknown
“”” return self>value. “””
pass
def __hash__(self, *args, **kwargs): # real signature unknown
“”” return hash(self). “””
pass
def __init__(self, seq=()): # known special case of tuple.__init__
“””
tuple() -> empty tuple
tuple(iterable) -> tuple initialized from iterable’s items
if the argument is a tuple, the return value is the same object.
# (copied from class doc)
“””
pass
def __iter__(self, *args, **kwargs): # real signature unknown
“”” implement iter(self). “””
pass
def __len__(self, *args, **kwargs): # real signature unknown
“”” return len(self). “””
pass
def __le__(self, *args, **kwargs): # real signature unknown
“”” return self

Posted in 未分类

发表评论