python时运行样例程序的几种常见错误

1、打印语句:python2.X   print  "This matrix is singular, cannot do inverse" 是没有括号的,python3.x中需要括号 print ("This matrix is singular, cannot do inverse")

2、urllib中的库问题  python2.x中的urllib是一个库 在3.x中则分成了3部分

The urllib2 module has been split across several modules in Python 3 named urllib.request and urllib.error. The 2to3 tool will automatically adapt imports when converting your sources to Python 3.
只需要把原来的 import urllib2 改成from urllib.request import urlopen就可以








你可能感兴趣的:(python使用)