zoukankan      html  css  js  c++  java
  • py2和py3的区别总结

    1.编码

    python2默认编码方式ASCII码(不能识别中文,要在文件头部加上  #-*- encoding:utf-8 -*-  指定编码方式)

    python3默认编码方式unicode(可识别中文)

     2.print

    python2中加不加括号都可以打印

    python3中必须加括号

    3.input

    python2 raw_input()
    python3 input()

     4.range()

    python2 range()/xrange()
    python3 range()

    5.类

    python3中都是新式类
    python2.7中经典类和新式类混合

    新式类中使用广度优先,经典类中使用深度优先

    python3可以使用super
    python2不能使用super

    ....持续更新中

  • 相关阅读:
    装配Bean
    百练
    东软小选拔
    俄罗斯乘法
    POJ
    ACdream
    javascript 链式作用域
    ie6/7 bug
    onreadystatechange 和 status
    瀑布流 <<转>>
  • 原文地址:https://www.cnblogs.com/jiangchengcheng/p/9525706.html
Copyright © 2011-2022 走看看