Difference between Python2 and Python3 [working in progress]

Print

It is no longer a statement/command, print() is a function in Python3

=====python2=====
print 'hello world'
print ('hello','world')
#hello world
#('hello','world')
=====python3=====
print 'hello world'
print ('hello','world')
#error
#hello world

Encode

Default encode changed from Ascii to UTF-8

=====python2=====
print sys.getdefaultencoding()
#ascii
=====python3=====
print (sys.getdefaultencoding())
#utf-8
    原文作者:bin_guo
    原文地址: https://www.jianshu.com/p/e995d15d45a3
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞