列表元组内置函数用法list

元组的用法和列表相似就不一一介绍了

1)def append(self, p_object):将值添加到列表的最后

# real signature unknown; restored from __doc__

""" L.append(object) -- append object to end """

pass

(2)def count(self, value): 值的出现次数

# real signature unknown; restored from __doc__

""" L.count(value) -> integer -- return number of occurrences of value """

return 0

(3)def extend(self, iterable): 扩展列表通过添加元素

# real signature unknown; restored from __doc__

""" L.extend(iterable) -- extend list by appending elements from the iterable """

pass

(4)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.

"""

return 0

(5)def insert(self, index, p_object):指定下标插入元素

# real signature unknown; restored from __doc__

""" L.insert(index, object) -- insert object before index """

pass

(6)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.

"""

pass

(7)def remove(self, value): 移除列表中的指定值第一个

# real signature unknown; restored from __doc__

"""

L.remove(value) -- remove first occurrence of value.

Raises ValueError if the value is not present.

"""

pass

(8)def reverse(self): 翻转

# real signature unknown; restored from __doc__

""" L.reverse() -- reverse *IN PLACE* """

pass

(9)def sort(self, cmp=None, key=None, reverse=False):比较大小

数字按照大小比较

中文按照unicode比较

# real signature unknown; restored from __doc__

"""

L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*;

cmp(x, y) -> -1, 0, 1

"""

pass

(10)def __add__(self, y): 加

# real signature unknown; restored from __doc__

""" x.__add__(y) <==> x+y """

pass

(11)def __contains__(self, y):包含

# real signature unknown; restored from __doc__

""" x.__contains__(y) <==> y in x """

pass

(12)def __delitem__(self, y): 删除单个序列元素

# real signature unknown; restored from __doc__

""" x.__delitem__(y) <==> del x[y] """

pass

(13)def __delslice__(self, i, j): 删除序列片断

# real signature unknown; restored from __doc__

"""

x.__delslice__(i, j) <==> del x[i:j]

Use of negative indices is not supported.

"""

pass

(14)def __eq__(self, y): 等于

# real signature unknown; restored from __doc__

""" x.__eq__(y) <==> x==y """

pass

(15)def __getattribute__(self, name): 取属性;内建 getattr();总是被调用

# real signature unknown; restored from __doc__

""" x.__getattribute__('name') <==> x.name """

pass

(16)def __getitem__(self, y): 得到单个序列元素

# real signature unknown; restored from __doc__

""" x.__getitem__(y) <==> x[y] """

pass

(17)def __getslice__(self, i, j): 得到序列片断

# real signature unknown; restored from __doc__

"""

x.__getslice__(i, j) <==> x[i:j]

Use of negative indices is not supported.

"""

pass

(18)def __ge__(self, y):大于等于

# real signature unknown; restored from __doc__

""" x.__ge__(y) <==> x>=y """

pass

(19)def __gt__(self, y):大于

# real signature unknown; restored from __doc__

""" x.__gt__(y) <==> x>y """

pass

(20)def __iadd__(self, y):

# real signature unknown; restored from __doc__

""" x.__iadd__(y) <==> x+=y """

pass

(21)def __imul__(self, y):

# real signature unknown; restored from __doc__

""" x.__imul__(y) <==> x*=y """

pass

(22)def __init__(self, seq=()): _init__方法在类的一个对象被建立时,马上运行

# known special case of list.__init__

"""

list() -> new empty list

list(iterable) -> new list initialized from iterable's items

# (copied from class doc)

"""

pass

(23)def __iter__(self): 创建迭代类;内建 iter()

# real signature unknown; restored from __doc__

""" x.__iter__() <==> iter(x) """

pass

(24)def __len__(self): 序列中项的数目长度

# real signature unknown; restored from __doc__

""" x.__len__() <==> len(x) """

pass

(25)def __le__(self, y):小于等于

# real signature unknown; restored from __doc__

""" x.__le__(y) <==> x<=y """

pass

(26)def __lt__(self, y):小于

# real signature unknown; restored from __doc__

""" x.__lt__(y) <==> x<y """

pass

(27)def __mul__(self, n): 重复;*操作符相乘

# real signature unknown; restored from __doc__

""" x.__mul__(n) <==> x*n """

pass

@staticmethod # known case of __new__

(28)def __new__(S, *more) 构造器(带一些可选的参数) ;通常用在设置不变数据类型的子类。

: # real signature unknown; restored from __doc__

""" T.__new__(S, ...) -> a new object with type S, a subtype of T """

pass

(29)def __ne__(self, y):不等于

# real signature unknown; restored from __doc__

""" x.__ne__(y) <==> x!=y """

pass

(30)def __repr__(self): 对机器友好

real signature unknown; restored from __doc__

""" x.__repr__() <==> repr(x) """

pass

(31)def __reversed__(self): 接受一个序列作为参数,返回一个以逆序访问的迭代器(PEP 322)

# real signature unknown; restored from __doc__

""" L.__reversed__() -- return a reverse iterator over the list """

pass

(32)def __rmul__(self, n): 反向相乘

# real signature unknown; restored from __doc__

""" x.__rmul__(n) <==> n*x """

pass

(33)def __setitem__(self, i, y): 设置单个序列元素

# real signature unknown; restored from __doc__

""" x.__setitem__(i, y) <==> x[i]=y """

pass

(34)def __setslice__(self, i, j, y): 设置序列片断

# real signature unknown; restored from __doc__

"""

x.__setslice__(i, j, y) <==> x[i:j]=y

Use of negative indices is not supported.

"""

pass

(35)def __sizeof__(self): 查看占用内存的函数

# real signature unknown; restored from __doc__

""" L.__sizeof__() -- size of L in memory, in bytes """

pass

__hash__ = None

list

Python成长之路第二篇(2)_列表元组内置函数用法的更多相关文章

  1. Python成长之路第二篇(1)_数据类型内置函数用法

    数据类型内置函数用法int 关于内置方法是非常的多这里呢做了一下总结 (1)__abs__(...)返回x的绝对值 #返回x的绝对值!!!都是双下划线 x.__abs__() <==> a ...

  2. Python成长之路第二篇(3)_字典的置函数用法

    字典的置函数用法(字典dict字典中的key不可以重复) class dict(object): """ dict() -> new empty dictionar ...

  3. python成长之路第二篇(4)_collections系列

    一.分别取出大于66的数字和小于66的数字 小练习:需求要求有一个列表列表中存着一组数字,要求将大于66的数字和小于66的数字分别取出来 aa = [11,22,33,44,55,66,77,88,9 ...

  4. Python基础学习笔记(七)常用元组内置函数

    参考资料: 1. <Python基础教程> 2. http://www.runoob.com/python/python-tuples.html 3. http://www.liaoxue ...

  5. Python元组内置函数

    Python元组内置函数: len(元组名): 返回元组长度 # len(元组名): # 返回元组长度 tuple_1 = (1,2,3,'a','b','c') print("tuple_ ...

  6. python整型-浮点型-字符串-列表及内置函数(上)

    整型 简介 # 是否可变类型: 不可变类型 # 作用:记录年龄.手机号 # 定义: age = 18 # --> 内部操作 age = int(18) # int('sada') # 报错 in ...

  7. python 内部函数,以及lambda,filter,map等内置函数

    #!/usr/bin/python #encoding=utf-8 def back(): return 1,2, "xxx" #python 可变参数 def test(*par ...

  8. 简学Python第三章__函数式编程、递归、内置函数

    #cnblogs_post_body h2 { background: linear-gradient(to bottom, #18c0ff 0%,#0c7eff 100%); color: #fff ...

  9. python基础-requests模块、异常处理、Django部署、内置函数、网络编程

     网络编程 urllib的request模块可以非常方便地抓取URL内容,也就是发送一个GET请求到指定的页面,然后返回HTTP的响应. 校验返回值,进行接口测试: 编码:把一个Python对象编码转 ...

随机推荐

  1. 简单的php数据库操作类代码(增,删,改,查)

    这几天准备重新学习,梳理一下知识体系,同时按照功能模块划分做一些东西.所以.mysql的操作成为第一个要点.我写了一个简单的mysql操作类,实现数据的简单的增删改查功能. 数据库操纵基本流程为: 1 ...

  2. awk之7 常用函数的解析

    1.区域获取 substr(区域f,起始位置n1,获取范围n2) 解析:获取某个区域f内,从起始位置n1开始算起的n2个字符组成的字符串.如果n2不存在,则返回从n1开始到区域结束的内容. 例子:获取 ...

  3. 关于url拼接传参数和利用view的字典传参数时,模板获取数据的方式问题

    url = "{% url 'dashboard:internship-theme-stat' %}?teacher_name="+teacher_name+"& ...

  4. iOS开发之网络篇-各种网络状态码

    1xx消息 这一类型的状态码,代表请求已被接受,需要继续处理.这类响应是临时响应,只包含状态行和某些可选的响应头信息,并以空行结束.由于HTTP/1.0协议中没有定义任何1xx状态码,所以除非在某些试 ...

  5. Linux vps无法发送邮件

    首先安装sendmail软件...yum install sendmail /etc/init.d/php-fpm restart 来检查下sendmail是否正常运行 /etc/init.d/sen ...

  6. 客户端HttpClient处理 Servlet Gzip

    服务端采用gzip对文本内容进行压缩处理,客户端使用HttpClient获取数据并进行gzip解压缩. 一: 服务端 public class GzipTestServlet extends Http ...

  7. 验证abc三列数字符合我的小弟要求

    需求好像是: 1.第一列数据有重复的找出来,并且找出它的重复位置 2.第三列根据第一列得出的位置,取出相应位置的数据进行相加 3.相加的结果 是否等同于第二列的对应位置数据 <!DOCTYPE ...

  8. BZOJ 1084 最大子矩阵

    http://www.lydsy.com/JudgeOnline/problem.php?id=1084 思路:分m=1和m=2操作 #include<algorithm> #includ ...

  9. keil C51 指针总结

    变量就是一种在程序执行过程中其值能不断变化的量.要在程序中使用变量必须先用标识符作为变量名,并指出所用的数据类型和存储模式,这样编译系统才能为变量分配相应的存储空间.定义一个变量的格式如下: [存储种 ...

  10. java中spring提供的属性copy方法

    BeanUtils.copyProperties(source, target); 今天用到属性的copy方法