python数据类型详解(二)列表

一.基本数据类型

  整数:int
  字符串:str(注:\t等于一个tab键)
  布尔值: bool
  列表:list (元素的集合)
  列表用[]
  元祖:tuple
  元祖用()
  字典:dict

注:所有的数据类型都存在想对应的类列里

二.列表所有数据类型:

基本操作:

索引,切片,追加,删除,长度,切片,循环,包含

list

class list(object):
“””
list() -> new empty list
list(iterable) -> new list initialized from iterable’s items
“””
def append(self, p_object): # real signature unknown; restored from __doc__
“”” l.append(object) -> none — append object to end “””
(l.append(对象)- >——没有一个对象附加到结束)
pass
def clear(self): # real signature unknown; restored from __doc__
“”” l.clear() -> none — remove all items from l “””
(l.clear()- >没有,把所有项目从l)
pass
def copy(self): # real signature unknown; restored from __doc__
“”” l.copy() -> list — a shallow copy of l “””
(l.copy()- >列表- l的浅拷贝)
return []
def count(self, value): # real signature unknown; restored from __doc__
“”” l.count(value) -> integer — return number of occurrences of value “””
(l.count(价值)- >整数,返回值的出现次数)
return 0
def extend(self, iterable): # real signature unknown; restored from __doc__
“”” l.extend(iterable) -> none — extend list by appending elements from the iterable “””
(l.extend(iterable)- >没有——从iterable扩展列表通过添加元)
pass
def index(self, value, start=none, stop=none): # real signature unknown; restored from __doc__
“””
l.index(value, [start, [stop]]) -> integer — return first index of value.
raises valueerror if the value is not present.
(l指数(价值,[开始,[不要]])- >整数,返回第一索引值。提出了valueerror如果不存在的价值。)
“””
return 0
def insert(self, index, p_object): # real signature unknown; restored from __doc__
“”” l.insert(index, object) — insert object before index “””
(l插入(指数(对象)——前插入对象索引)
pass
def pop(self, index=none): # real signature unknown; restored from __doc__
“””
l.pop([index]) -> item — remove and return item at index (default last).
raises indexerror if list is empty or index is out of range.
(l.pop((指数))- >项目——删除并返回项指数(默认)。提出了indexerror如果列表为空或索引的范围。)
“””
pass
def remove(self, value): # real signature unknown; restored from __doc__
“””
l.remove(value) -> none — remove first occurrence of value.
raises valueerror if the value is not present.
“””
(l.remove(价值)- >没有,删除第一次出现的值。提出了valueerror如果不存在的价值。)
pass
def reverse(self): # real signature unknown; restored from __doc__
“”” l.reverse() — reverse *in place* “””
pass
def sort(self, key=none, reverse=false): # real signature unknown; restored from __doc__
“”” l.sort(key=none, reverse=false) -> none — stable sort *in place* “””
pass
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 __delitem__(self, *args, **kwargs): # real signature unknown
“”” delete self[key]. “””
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, y): # real signature unknown; restored from __doc__
“”” x.__getitem__(y) x[y] “””
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 __iadd__(self, *args, **kwargs): # real signature unknown
“”” implement self+=value. “””
pass
def __imul__(self, *args, **kwargs): # real signature unknown
“”” implement self*=value. “””
pass
def __init__(self, seq=()): # known special case of list.__init__
“””
list() -> new empty list
list(iterable) -> new list initialized from iterable’s items
# (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 未分类