摘要: operator.itemgetter函数operator模块提供的itemgetter函数用于获取对象的哪些维的数据,参数为一些序号(即需要获取的数据在对象中的序号),下面看例子。 a = [1,2,3] >>> b=operator.itemgetter(1) //定义函数b,获取对象的第1个域 阅读全文
posted @ 2016-11-24 16:52 holy_black_cat 阅读(267) 评论(0) 推荐(0)
摘要: >>> import numpy>>> help(numpy.argsort)Help on function argsort in module numpy.core.fromnumeric:argsort(a, axis=-1, kind='quicksort', order=None)Retu 阅读全文
posted @ 2016-11-24 15:38 holy_black_cat 阅读(910) 评论(0) 推荐(0)
摘要: list是列表,可以通过索引查找数值,但是不能对整个列表进行数值运算In [96]: b=[1,2]In [97]: b[1]Out[97]: 2In [98]: type(b)Out[98]: listIn [99]: b+bOut[99]: [1, 2, 1, 2]array是数组,也可以通过索 阅读全文
posted @ 2016-11-24 15:05 holy_black_cat 阅读(1959) 评论(0) 推荐(0)
摘要: operator模块中包含了Python的各种内置操作符,诸如逻辑、比较、计算等,这里我们针对一些常用的操作符来作一个Python中operator模块的操作符使用示例总结: operator模块是python中内置的操作符函数接口,它定义了一些算术和比较内置操作的函数。operator模块是用c实 阅读全文
posted @ 2016-11-24 15:01 holy_black_cat 阅读(152) 评论(0) 推荐(0)