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) |