Python2 和 Python3区别

  • 字符串类型不一样编码

    • py3: str bytesspa

    • py2: unicode strcode

  • 默认解释器编码索引

  • 输入输出unicode

  • int字符串

    • int longit

    • 除法class

  • range和xrang循环

  • 模块和包map

  • 字典

    • keys

      • py2:列表

      • py3:迭代器,能够循环但不能够索引

    • values

      • py2:列表

      • py3:迭代器,能够循环但不能够索引

    • items

      • py2:列表

      • py3:迭代器,能够循环但不能够索引

  • map/filter

    • py2:返回列表

    • py3:返回迭代器,能够循环但不能够索引