小小爬虫问题
urllib.error.URLError:<urllopen error no host given>这个错误怎么解决?{:10_279:}{:10_279:} 网址有没有打错?
请把完整代码发上来 liuzhengyuan 发表于 2020-4-22 18:18
网址有没有打错?
请把完整代码发上来
import urllib.request
reponse = urllib.request.urlopen("http:\\placekitten.com\g\500\600")
html = response.read()
with open("c:\\a\\html.jpg",'wb') as f:
f.write(html)
是正斜杠,不是反斜杠(这是一个成功的代码)
import urllib.request
response = urllib.request.urlopen('http://placekitten.com/g/200/300')
cat_img = response.read()
with open('cat_200_300.jpg', 'wb') as f:
f.write(cat_img)
谢谢大佬
页:
[1]