python2与python3两版本的区别是众所周知的,今天主要记录python下版本2 与版本3的区别 python2 In [7]: logfile = open('/tmp/mylog.log', 'a') In [8]: print >> logfile, 'writeen by python version 2' In [9]: logfile.close() In [10]: cat /tmp/mylog.log writeen by python version 2 python…
原文地址:http://old.sebug.net/paper/books/dive-into-python3/porting-code-to-python-3-with-2to3.html 使用2to3将代码移植到Python 3 ❝ Life is pleasant. Death is peaceful. It’s the transition that’s troublesome. ❞— Isaac Asimov (attributed) 概述 几乎所有的Python 2程序都需要一些修改…