web crawling(plus4) pretend to be A web

#Author:Mini
#!/usr/bin/env python
import urllib.request
url1="http://blog.sina.com.cn/s/blog_470071c90102x8jc.html"
headers=("User-Agent","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36Query String Parametersview sourceview URL encoded")
opener=urllib.request.build_opener()
opener.add_handler=[headers]
data=opener.open(url1).read()
fh=open("E:/4.html","wb")
fh.write(data)
fh.close()
posted @ 2017-10-02 17:14  兔子的尾巴_Mini  阅读(135)  评论(0编辑  收藏  举报