文章目录
ImportError: Install xlrd >= 0.9.0 for Excel support
因为之前包都是在Python3.6安装的,2.7几乎没有任何包
虽然明明没有用到这个xlrd,用的是xlwt.
但是出现了这个提示,安装上就好了…
urllib2和urllib.request
request = urllib.request.Request(url)
response = urllib.request.urlopen(request)
content = response.read()
有这样的代码,这样的在Python3里是可以用的,
降级到2.7的时候,就不能使用.
需要将urllib.request.Request修改为urllib2.Request
原因是Python2里有urllib和urllib2两个,在Python3里就只有一个urllib了.
TypeError: ‘newline’ is an invalid keyword argument for this function
with open(total_csv_name, "w", newline='') as f:
代码在Python3是这样的,用来写CSV文件的代码…
改成2.7后就报错了
TypeError: 'newline' is an invali