Python2和Python3之间的区别

编码区别

  Python3.X版本中源码文件默认使用的是utf-8编码

Unicode 字符串

  Python 2有两种字符串类型:Unicode字符串和非Unicode字符串

  Python 3只有一种类型:Unicode字符串

个别函数区别

print 函数
2.7版本:print "hello world"  或者 print("hello world")
3.x版本:print("hello world")

  

模块命名区别

  在两个大版本中,许多相同功能的模块的名字发生了改变,部分举例如下

持续更新中。。。

原文地址:https://www.cnblogs.com/wang-yc/p/6420319.html