这个模块提供了一系列的函数操作。比如,operator.add(x, y)等于x+y


a = [1,2,3]
b = [5,6,7]
c = map(operator.mul, a, b)
c的值就为[5, 12, 21]

abs(...)
        abs(a) -- Same as abs(a).
   
    add(...)
        add(a, b) -- Same as a + b.
   
    and_(...)
        and_(a, b) -- Same as a & b.
   
    concat(...)
        concat(a, b) -- Same as a + b, for a and b sequences.
   
    contains(...)
        contains(a, b) -- Same as b in a (note reversed operands).
   
    countOf(...)
        countOf(a, b) -- Return the number of times b occurs in a.
   
    delitem(...)
        delitem(a, b) -- Same as del a[b].
   
    delslice(...)
        delslice(a, b, c) -- Same as del a[b:c].
   
    div(...)
        div(a, b) -- Same as a / b when __future__.division is not in effect.
   
    eq(...)
        eq(a, b) -- Same as a==b.
   
    floordiv(...)
        floordiv(a, b) -- Same as a // b.
   
    ge(...)
        ge(a, b) -- Same as a>=b.
   
    getitem(...)
        getitem(a, b) -- Same as a[b].
   
    getslice(...)
        getslice(a, b, c) -- Same as a[b:c].
   
    gt(...)
        gt(a, b) -- Same as a>b.
   
    iadd(...)
        iadd(a, b) -- Same as a += b.
   
    iand(...)
        iand(a, b) -- Same as a &= b.
   
    iconcat(...)
        iconcat(a, b) -- Same as a += b, for a and b sequences.
   
    idiv(...)
        idiv(a, b) -- Same as a /= b when __future__.division is not in effect.
   
    ifloordiv(...)
        ifloordiv(a, b) -- Same as a //= b.
   
    ilshift(...)
        ilshift(a, b) -- Same as a <<= b.
   
    imod(...)
        imod(a, b) -- Same as a %= b.
   
    imul(...)
        imul(a, b) -- Same as a *= b.
    index(...)
        index(a) -- Same as a.__index__()
   
    indexOf(...)
        indexOf(a, b) -- Return the first index of b in a.
   
    inv(...)
        inv(a) -- Same as ~a.
   
    invert(...)
        invert(a) -- Same as ~a.
   
    ior(...)
        ior(a, b) -- Same as a |= b.
   
    ipow(...)
        ipow(a, b) -- Same as a **= b.
   
    irepeat(...)
        irepeat(a, b) -- Same as a *= b, where a is a sequence, and b is an integer.
   
    irshift(...)
        irshift(a, b) -- Same as a >>= b.
   
    isCallable(...)
        isCallable(a) -- Same as callable(a).
   
    isMappingType(...)
        isMappingType(a) -- Return True if a has a mapping type, False otherwise.
   
    isNumberType(...)
        isNumberType(a) -- Return True if a has a numeric type, False otherwise.
   
    isSequenceType(...)
        isSequenceType(a) -- Return True if a has a sequence type, False otherwise.
   
    is_(...)
        is_(a, b) -- Same as a is b.
    is_not(...)
        is_not(a, b) -- Same as a is not b.
   
    isub(...)
        isub(a, b) -- Same as a -= b.
   
    itruediv(...)
        itruediv(a, b) -- Same as a /= b when __future__.division is in effect.
   
    ixor(...)
        ixor(a, b) -- Same as a ^= b.
   
    le(...)
        le(a, b) -- Same as a<=b.
   
    lshift(...)
        lshift(a, b) -- Same as a << b.
   
    lt(...)
        lt(a, b) -- Same as a<b.
   
    mod(...)
        mod(a, b) -- Same as a % b.
   
    mul(...)
        mul(a, b) -- Same as a * b.
   
    ne(...)
        ne(a, b) -- Same as a!=b.
   
    neg(...)
        neg(a) -- Same as -a.
   
    not_(...)
        not_(a) -- Same as not a.
   
    or_(...)
        or_(a, b) -- Same as a | b.
    pos(...)
        pos(a) -- Same as +a.
   
    pow(...)
        pow(a, b) -- Same as a ** b.
   
    repeat(...)
        repeat(a, b) -- Return a * b, where a is a sequence, and b is an integer.
   
    rshift(...)
        rshift(a, b) -- Same as a >> b.
   
    sequenceIncludes(...)
        sequenceIncludes(a, b) -- Same as b in a (note reversed operands; deprecated).
   
    setitem(...)
        setitem(a, b, c) -- Same as a[b] = c.
   
    setslice(...)
        setslice(a, b, c, d) -- Same as a[b:c] = d.
   
    sub(...)
        sub(a, b) -- Same as a - b.
   
    truediv(...)
        truediv(a, b) -- Same as a / b when __future__.division is in effect.
   
    truth(...)
        truth(a) -- Return True if a is true, False otherwise.
   
    xor(...)
        xor(a, b) -- Same as a ^ b.

python中的operator库相关推荐

  1. python中nlp的库_单词袋简介以及如何在Python for NLP中对其进行编码

    python中nlp的库 by Praveen Dubey 通过Praveen Dubey 单词词汇入门以及如何在Python中为NLP 编写代码的简介 (An introduction to Bag ...

  2. python中的迭代库

    python中的迭代库为itertools,如果需要输出详细,需要使用类型工厂函数,如list,tuple将结果转换 itertools.product:product(A,B) 相当于((x, y) ...

  3. python中调用c库

    python中调用c库 2013-04-23 15:34:52|  分类: python核心编程 |  标签:python  makefile   |举报 |字号 订阅 参考地址:http://my. ...

  4. Python中第三方的库(library)、模块(module),包(package)的安装方法以及ImportError: No module named...

    Python中,想要安装第三方安装包,即third library,package等,对于熟悉的人来说,很简单. 但是对于新手,至少对于之前的我,很难,往往只是安装一个很小的包,都被搞得一头雾水. 现 ...

  5. python中nlp的库_用于nlp的python中的网站数据清理

    python中nlp的库 The most important step of any data-driven project is obtaining quality data. Without t ...

  6. Python中的operator.itemgetter函数

    Python中的operator模块中的itemgetter函数的作用是获取对象哪些维的数据,参数是表示维的序号. operator.itemgetter函数定义的是一个函数,通过该函数作用到对象上才 ...

  7. 利用python中的csv库读写csv文件

    利用python中的csv库读写csv文件 python读写csv文件就我知道的方法有:1)利用csv库,2)利用读写txt文件的方式处理,3)利用numpy或pandas库处理 在这篇博客中,博主就 ...

  8. 用python中的turtle库绘制一些有趣的图

    最近有个在读大学的女生,想要我帮忙用python画几个图,在画的过程中觉得有些图还挺有意思的,分享给大家.    1 图1    第一个图是蚊香,感兴趣的小伙伴可以自己尝试在python中用turtl ...

  9. python中的sheet,Python中的Smartsheet库:模块'smartsheet.sheets'没有属性'sheets'

    我正在尝试在python中使用smartsheet库. 使用'$ pip install smartsheet-python-sdk'完成pip安装. 我使用以下代码在令牌上进行了测试. import ...

最新文章

  1. Window编程主函数详解
  2. nginx下部署vue项目
  3. 当数据库遇见FPGA:X-DB异构计算如何实现百万级TPS?
  4. Sharepoint学习笔记—Ribbon系列-- 3.在Ribbon中找到正确的Location
  5. Linux_学习_Day3_bash
  6. ZZULIOJ 1098: 复合函数求值(函数专题)
  7. 尚学堂java答案解析 第二章
  8. es6 Generator函数的应用
  9. JS中的六大数据类型 (笔记0)
  10. 如果想成为数据科学家,请学习这3种语言
  11. 计算机专业英文授课,计算机专业全英文授课分析
  12. MTSP遗传算法解决
  13. C++11多线程 内存序(std::memory_order_relaxed)
  14. Ubuntu上安装博通无线网卡驱动
  15. 使用Python调整图片尺寸(大小)
  16. 微信模板消息 群发 突破 4条限制
  17. 神舟Z7本安装Linux系统,神舟战神Z7M U盘装系统win7教程
  18. 服务器定时执行js脚本
  19. 《校园十大优秀青年评比》课程设计作品——顺利通过!!!
  20. 广州欧米区块链科技×浙江墨客奇迹区块链科技丨达成战略合作共识

热门文章

  1. 程序员面试题精选100题(47)-数组中出现次数超过一半的数字[算法]
  2. 【OpenCV3】彩色映射——cv::applyColorMap()与cv::LUT()详解
  3. python继承父类的调用
  4. Atom相关资料整理
  5. python基础练习_1
  6. No Team Selected:A team must be selected to run 'ProjectName' on iPhoneName
  7. 周跃教授:脊柱微创手术机器人在脊柱手术中的应用前景 (转载)
  8. 娱乐化手游营销模式探索
  9. 用ProFTPD构建FTP服务器
  10. django项目实战(2)-数据库配置