论一只爬虫的自我修养(第一天)
论一只爬虫的自我修养(第一天)
爬取一张图片
import urllib
req = urllib.Request('http://placekitten.com/g/500/600')
response = urllib.urlopen(req)
#urllib 下的read方法:
cat_img = response.read()
with open('cat.png','wb') as f:
f.write(cat_img)
论一只爬虫的自我修养(第一天)
爬取一张图片
import urllib
req = urllib.Request('http://placekitten.com/g/500/600')
response = urllib.urlopen(req)
#urllib 下的read方法:
cat_img = response.read()
with open('cat.png','wb') as f:
f.write(cat_img)