abs(x)
返回数值的绝对值,参数x为整形或者浮点型
all(iterable)
判断迭代器对象中的元素是否全为真,若是则返回真,等价代码如下:
def all(iterable):
for element in iterable:
if not element:
return False
return True
any(iterable)
判断迭代器对象中的元素是否有任意一个元素为真,若是则返回真。
basestring()
- str 和 unicode的超类,不能被实例化。但是可以用于判断一个对象是否是字符串型的,isinstance(obj, basestring)=isinstance(obj, (str, unicode))
bin(x)
- 将整形的数值转换为字符串类型的2进制格式,若x不是一个整形,则必须拥有返回int(long)类型的__index__()方法
bool(x)
bytearray([source[, encoding[, errors]]])
- 将source对象转换成一个字节数组,如果1.source是字符串类型的,则encoding参数必须给定,返回source.encode()。2.如果source是一个整数,则数组大小值将被设置为source,每个数组元素都是个空字节(0)。3.如果是个可迭代对象,则每个元素都必须是[0,256)之间的整数,该迭代对象的内容即位数组内容。
callable(object)
chr(i)
- 将i转换成对应的ascii字符,0<=i<=255
cmp(x,y)
delattr(object, name)
- 删除objct中名为name的属性,等同于del object.name
dir([object])
- 不带参数返回当前的local scope,否则返回参数的属性列表
divmod(a, b)
- 返回a,b商和余数的元组,相当于(a // b, a % b).
enumerate(sequence, start=0)
返回列表元素和其位置的元组的enumerate对象,可用于循环迭代
>>> seasons = ['Spring', 'Summer', 'Fall', 'Winter']
>>> list(enumerate(seasons))
[(0, 'Spring'), (1, 'Summer'), (2, 'Fall'), (3, 'Winter')]
filter(function, iterable)
- 函数式编程的支持函数,过滤出使得function返回True的iterable中的元素,如果iterable是字符串类型或者元组类型(tuple),则返回字符串或者tuple。如果function参数为None,则元素本身为真的被返回。
filter(function, iterable)等价于[item for item in iterable if function(item)] ,如果function为None则,等价于[item for item in iterable if item]
getattr(object, name[, default])
- 返回object名字为name的属性值,如果不存在该属性,若有default参数则返回default,否则抛出异常
[list]
globals()
[list]
- 返回当前模块的全局符号表,它返回的是定义时的模块,而不是引入模块的全局符号表。
hasattr(object, name)
hash(object)
- 返回对象的hash值,注意,相等的对象应该返回相同的哈希值
hex(x)
- 将x转成16进制表示的字符串,若要得到float型的十六进制表示,使用 float.hex()
id(object)
- 返回对象全局唯一的id值,唯一标识一个object
isinstance(object, classinfo)
- 判断一个对象是否是classinfo的实例。支持类型继承体系。从2.2之后,classinfo,可以是包含多个类型的元组对象
issubclass(class, classinfo)
- 判断class是否是classinfo的子类。继承体系。从2.2之后,classinfo,可以是包含多个类型的元组对象
iter(o[, sentinel])
- 返回一个迭代对象,它的行为依据是否存在sentinel而不同,1如果不存在sentinel参数,则o必须是个集合型对象,即它必须支持__iter__()方法,或者接收一个从0开始的整形参数的__getitem__(),2如果存在sentinel参数,则o必须是一个可调用对象,返回的迭代对象,每次调用其next()方法,都会调用O(),直到o()==sentinel,则抛出StopIteration
len(s)
locals()
map(function, iterable, ...)
- 支持函数式编程的函数,对每个iterable的元素应用funtion,然后返回应用后的结果列表,若有多个iterable的参数,则function将接收多个参数。该函数总是返回list
max(iterable[, key])
- 返回迭代器元素中最大的元素,可以接收一个对比函数(key)
min(iterable[, key])
- 返回迭代器元素中最小的元素,可以接收一个对比函数(key)
open(name[, mode[, buffering]])
pow(x, y[, z])
- 指数函数,相当于x ** y,如果存在z,则相当于x ** y % z
range(stop),range(start, stop[, step])
- 范围函数,range(5) = [0,1, 2, 3, 4],range(1, 5, 2)=[1, 3]
reduce(function, iterable[, initializer])
函数式编程的支持函数.等价代码如下:
def reduce(function, iterable, initializer=None):
it = iter(iterable)
if initializer is None:
try:
initializer = next(it)
except StopIteration:
raise TypeError('reduce() of empty sequence with no initial value')
accum_value = initializer
for x in it:
accum_value = function(accum_value, x)
return accum_value
repr(object)
- 返回对象的字符串表示,object可以通过重定义的__repr__()方法控制结果
reversed(seq)
round(number[, ndigits])
- 以四舍五入的形式截取小数位,注意round(2.766, 2) = 2.77, round(2.765, 2) = 2.76
sorted(iterable[, cmp[, key[, reverse]]])
sum(iterable[, start])
zip([iterable, ...])
支持函数式编程的函数,实例如下:
>>> x = [1, 2, 3]
>>> y = [4, 5, 6]
>>> zipped = zip(x, y)
>>> zipped
[(1, 4), (2, 5), (3, 6)]
>>> x2, y2 = zip(*zipped)
>>> x == list(x2) and y == list(y2)
[/list]
分享到:
相关推荐
基于BIFS的场景分析与应用,顾杰诗,,大多数情况下用户只能被动地观看多媒体内容,并不能与之进行交互。在MPEG-4标准中,不仅提出了对象的概念,还引入了交互性特征。文
1. python中的函数 ■ 函数的意义: ■1.对输入进行变换映射后输出 ,可以进行反复调用。以函数名对代码块进行封装 ■2.过程化 VS 结构化 ■ 函数的创建及结构: ■定义函数名:def foo1(num): ■参数:num ■函数体 ...
-make-isma-10-compliant Insert bifs and od tracks required for some ISMA playe rs (also -i) -mpeg4-video-profile=<level> Mpeg4 video profile override -mtu=<size> Maximum Payload size for RTP ...
检测和跟踪附着在神经元表面的量子的活动信息对于全面...使用BIFs方法提取图像中的量子目标,并通过优化BIFs参数配置和融合高斯滤波预处理提高算法性能。实验结果表明该方法对强杂波干扰下的量子目标具有较高的检测率。
explaining which pieces of technology it includes and what sort of applications are supported by this technology. <br>Table of Contents l Executive Overview l Table of Contents l 1....
whitepaper_mpeg-if_understanding_mpeg4.pdf whitepaper_mpeg4_bifs.pdf whitepaper_mulitrate_encoding.pdf mpeg4--标准白皮书.pdf MP4中文总结-简单版
前寒武纪条带状铁建造(BIFs)蕴含丰富的铁矿石资源,记录了早期地球演化的重要信息。鞍山―本溪地区发育巨量的太古宙BIFs。鞍山―本溪地区BIFs由互层的硅铁条带组成,金属矿物以磁铁矿为主,含少量赤铁矿、黄铁矿及...
matlab浅黄色代码二进制文件库 一个用于从图像有效生成基本图像特征 (BIF) 的 MATLAB 库。 快速开始 安装 键入mtInstallBifLab在MATLAB命令行BifLab文件夹添加到Matlab的路径 演示 在 Matlab 命令行中键入...
Chapter 1 • Introduction 1 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Organization ...