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

你可能感兴趣的:(Difference between Python2 and Python3 [working in progress])