7-17(python2\3一些區別記錄)

1、python2\3一些區別記錄

python2.7 python3.5
print "test " print (“test”)
import thread import _thread
_iterator.next() next(_iterator)
xrange(10) range(10)
reduce(a,b,c) from functools import reduce reduce(a, b, c)
x= 0755 x = 0o755(八進制)
[ i for i in 9, 2] [ i for i in (9, 2)]
7/2 = 3; from future import division 7/2=3 7/2=3.5; 7//2=3
watches = sorted(watches, key=takeFrist) watches.sort(key=takeFrist)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章