1、print 在 Python3 中是函数必须加括号,Python2 中 print 为 class。
2、Python2 中使用 xrange,Python3 使用 range。
3、Python2 中默认的字符串类型默认是 ASCII,Python3 中默认的字符串类型是 Unicode。
4、Python2 中/的结果是整型,Python3 中是浮点类型。
5、Python2 中声明元类:metaclass = MetaClass,Python3 中声明元类:class newclass(metaclass=MetaClass):pass。
网友评论