python Function
Python 2.7.10 (default, Oct 14 2015, 16:09:02)
[GCC 5.2.1 20151010] on linux2
Type "copyright", "credits" or "license()" for more information.
>>> help(list)
Help on class list in module __builtin__: class list(object)
| list() -> new empty list
| list(iterable) -> new list initialized from iterable's items
|
| Methods defined here:
|
| __add__(...)
| x.__add__(y) <==> x+y
|
| __contains__(...)
| x.__contains__(y) <==> y in x
|
| __delitem__(...)
| x.__delitem__(y) <==> del x[y]
|
| __delslice__(...)
| x.__delslice__(i, j) <==> del x[i:j]
|
| Use of negative indices is not supported.
|
| __eq__(...)
| x.__eq__(y) <==> x==y
|
| __ge__(...)
| x.__ge__(y) <==> x>=y
|
| __getattribute__(...)
| x.__getattribute__('name') <==> x.name
|
| __getitem__(...)
| x.__getitem__(y) <==> x[y]
|
| __getslice__(...)
| x.__getslice__(i, j) <==> x[i:j]
|
| Use of negative indices is not supported.
|
| __gt__(...)
| x.__gt__(y) <==> x>y
|
| __iadd__(...)
| x.__iadd__(y) <==> x+=y
|
| __imul__(...)
| x.__imul__(y) <==> x*=y
|
| __init__(...)
| x.__init__(...) initializes x; see help(type(x)) for signature
|
| __iter__(...)
| x.__iter__() <==> iter(x)
|
| __le__(...)
| x.__le__(y) <==> x<=y
|
| __len__(...)
| x.__len__() <==> len(x)
|
| __lt__(...)
| x.__lt__(y) <==> x<y
|
| __mul__(...)
| x.__mul__(n) <==> x*n
|
| __ne__(...)
| x.__ne__(y) <==> x!=y
|
| __repr__(...)
| x.__repr__() <==> repr(x)
|
| __reversed__(...)
| L.__reversed__() -- return a reverse iterator over the list
|
| __rmul__(...)
| x.__rmul__(n) <==> n*x
|
| __setitem__(...)
| x.__setitem__(i, y) <==> x[i]=y
|
| __setslice__(...)
| x.__setslice__(i, j, y) <==> x[i:j]=y
|
| Use of negative indices is not supported.
|
| __sizeof__(...)
| L.__sizeof__() -- size of L in memory, in bytes
|
| append(...)
| L.append(object) -- append object to end
|
| count(...)
| L.count(value) -> integer -- return number of occurrences of value
|
| extend(...)
| L.extend(iterable) -- extend list by appending elements from the iterable
|
| index(...)
| L.index(value, [start, [stop]]) -> integer -- return first index of value.
| Raises ValueError if the value is not present.
|
| insert(...)
| L.insert(index, object) -- insert object before index
|
| pop(...)
| L.pop([index]) -> item -- remove and return item at index (default last).
| Raises IndexError if list is empty or index is out of range.
|
| remove(...)
| L.remove(value) -- remove first occurrence of value.
| Raises ValueError if the value is not present.
|
| reverse(...)
| L.reverse() -- reverse *IN PLACE*
|
| sort(...)
| L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*;
| cmp(x, y) -> -1, 0, 1
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __hash__ = None
|
| __new__ = <built-in method __new__ of type object>
| T.__new__(S, ...) -> a new object with type S, a subtype of T >>> a='nihao'
>>> a
'nihao'
>>> a=list(a)
>>> a
['n', 'i', 'h', 'a', 'o']
>>> max(1,2,3,7,6,5)
7
>>> num=[1,2,3,4,]
>>> len(num)
4
>>> max(num)
4
>>> min(num)
1
>>> a=(1,2,3,4,5)
>>> type(a)
<type 'tuple'>
>>> max(a)
5
>>> min(a)
1
>>> str=""
>>> min(str)
''
>>> max(str)
''
>>> str='23eras'
>>> max(str)
's'
>>> min(str)
''
>>>
>>>
>>>
>>>
>>> num=[1,2,3,4]
>>> max=num[0]
>>> for each in num:
if each>max:
max=each >>> max
4
>>> sum(num)
10
>>> sum(num,1)
11
>>> enumerate(num)
<enumerate object at 0xb53fc784>
>>> list(enumerate(num))
[(0, 1), (1, 2), (2, 3), (3, 4)]
>>> zip(num)
[(1,), (2,), (3,), (4,)]
>>> a=[5,6,7]
>>> zip(num,a)
[(1, 5), (2, 6), (3, 7)]
>>> sorted(num)
[1, 2, 3, 4]
>>> reversed(num)
<listreverseiterator object at 0xb53edb8c>
>>> list(reversed(num))
[4, 3, 2, 1]
>>>
python Function的更多相关文章
- Python Function Note
Python Function Note #汉诺塔问题Python实现 def my_move(n, a, b, c): if n == 1: print(a + ' --> ' + c) el ...
- python function parameter
Python 2.7.10 (default, Oct 14 2015, 16:09:02) [GCC 5.2.1 20151010] on linux2 Type "copyright&q ...
- kwargs - Key words arguments in python function
This is a tutorial of how to use *args and **kwargs For defining the default value of arguments that ...
- elike.python.function()
将python用于基本的科学计算,能完全替代matlab.就最近写的一个物理模型程序来看,用python建立的物理模型的可控性,代码的层次性都优于matlab,只不过python没有matlab那样的 ...
- python function with variadic arguments or keywords(dict) 可变参数与关键字参数
*args 表示任意个普通参数,调用的时候自动组装为一个tuple **kwags 表示任意个字典类型参数, 调用的时候自动组装成一个dict args和kwags是两个约定俗成的用法. 变长参数可以 ...
- Python黑帽编程 3.2 ARP监控
Python黑帽编程 3.2 ARP监控 在第3.1节<ARP欺骗>中,我们学习了ARP的基本原理,使用Python实现了我们自己的ARP欺骗工具.在上一节的基础上,我们来实现一个ARP监 ...
- Python黑客编程ARP欺骗
Python灰帽编程 3.1 ARP欺骗 ARP欺骗是一种在局域网中常用的攻击手段,目的是让局域网中指定的(或全部)的目标机器的数据包都通过攻击者主机进行转发,是实现中间人攻击的常用手段,从而实现数据 ...
- python练手基础
Python相关文档0.1. Python标准文档0.2. Python实用大全0.3. 迷人的Python0.4. 深入理解Python0.5. Python扩展库网址 http://pypi.py ...
- sparksql udf的运用----scala及python版(2016年7月17日前完成)
问:udf在sparksql 里面的作用是什么呢? 答:oracle的存储过程会有用到定义函数,那么现在udf就相当于一个在sparksql用到的函数定义: 第二个问题udf是怎么实现的呢? regi ...
随机推荐
- C#基础系列——一场风花雪月的邂逅:接口和抽象类
前言:最近一个认识的朋友准备转行做编程,看他自己边看视频边学习,挺有干劲的.那天他问我接口和抽象类这两个东西,他说,既然它们如此相像, 我用抽象类就能解决的问题,又整个接口出来干嘛,这不是误导初学者吗 ...
- [转]java selenium webdriver实战 应用小结
原文链接:http://www.cnblogs.com/itliucheng/p/5578788.html 部分api 1.访问网站 driver.get("http://www.baidu ...
- 【CF 710F】String Set Queries
在校内OJ上A了,没有加强制在线的东西..不放链接了. 这道题题意是维护一个字符串集合,支持三种操作: 1.加字符串 2.删字符串 3.查询集合中的所有字符串在给出的模板串中出现的次数 操作数\(m ...
- 分享我的开源项目-springmore
之前有在博客园分享过springmore,不知道是什么原因,被管理员移除首页 在此郑重声明,这是我个人的开源项目,东西不多,也不存在打广告,也没有什么利益可图 完全是出于分享的目的,望博客园管理员予以 ...
- delphi 默认值
只有全局变量才可以赋初值 i:integer=0;
- Windows 10一周年更新正式版官方ISO镜像(1607)
微软已经开始推送Win10一周年更新正式版系统,按照此前预告微软官方网站也同步推出了Win10一周年更新正式版ISO官方镜像下载,版本已经升级到最新的1607,也就是Win10 Build 1607, ...
- java环境配置
一.下载安装sdk jdk和jre的区别: jdk:是编译环境(编译器),把java文件编译成class文件 jre:是运行环境(运行器),执行class文件需要使用jre eclipse开发出jav ...
- 如何查看Maven项目中的jar包依赖树情况
对于开发人员,我想大家对于Maven应该不会陌生吧,如何在一个Maven项目中对这个项目中所引用的第三方jar包有个直观的了解呢? 其实实现很简单,只需要借助于Maven的一条命令,如下所示: mvn ...
- BZOJ4285: 使者
搞出dfs序,转化为查询矩形点数,树套树搞定. #include<cstdio> #include<cstdlib> #define N 100005 #define IF e ...
- Eclipse Maven3新建web项目
环境: Eclipse Neon JDK1.8 先决条件: 本机下载apache-tomcat-8,解压,在Eclipse->preferences->server里配置安装目录.并在ec ...