PYTHON_3和2

1.引用的模块不同,

python2.x中的urllib2在python3.x中为urllib.request

2.输出方式不同

python2.x中的print在python3.x中为print()

3.输入方式不同

python2.x中的raw_input()在python3.x中为input()

4.处理异常的不同

python2.x中的try:  ......

except urllib2.URLError,e:     ......

在python3.x中为try: ......

except urllib.request.URLError  ase: ......

原文地址:https://www.cnblogs.com/wilson297/p/6445454.html