Traceback (most recent call last): ? File "C:\Python25\another_spider.py", line 1, in <module> ??? import urllib.request ImportError: No module named request
Traceback (most recent call last):
File "C:\Python25\another_spider.py", line 1, in <module>
import urllib.request
ImportError: No module named request
2017-08-13
額,說(shuō)錯(cuò)了,是python 3中取消了urllib2,在3中需要導(dǎo)入urllib.request
2017-08-13
額,python3啊,你這是python2.5, ? 2.5中取消了urllib2 ,在3中是需要導(dǎo)入urllib.request
2017-08-12
Traceback (most recent call last):
? File "C:\Python25\another_spider.py", line 1, in <module>
??? import urllib.request
ImportError: No module named request
2017-08-12
這樣改一下:#python3版本
import urllib.request
url = "
response = urllib.request.urlopen(url)
print(response.getcode())
print(len(response.read()))
2017-08-12
換成urllib2也不行的好像。Python2.5環(huán)境下。
2017-08-12
就這個(gè),老師的代碼。是哪里寫錯(cuò)了還是那個(gè)?
2017-08-11
可以啊,返回Http狀態(tài)碼,我的就是2.7