-
爬虫基本
python包
打开网页
import urllib.request
#req=urllib.request.Request('http://placekitten.com/g/500/600')
#response = urllib.request.urlopen(req)
response = urllib.request.urlopen('http://placekitten.com/g/500/600')
cat_img = response.read().decode('utf-8')
with open('cat_500_600.jpg','wb') as f:
f.write(cat_img)
修改header
代理
- 正则表达式
re.search(r'FishC','I love FishC.com!')
search方法
image.png
网友评论