05 2018 档案

摘要:import reimport urllib.requestimport timeimport urllib.errordef wei(url,duan): try: open_url=urllib.request.Request(url) open_url.add_header("User-Age 阅读全文
posted @ 2018-05-23 20:24 纯情 阅读(259) 评论(0) 推荐(0)
摘要:先把fiddler装好 然后对你所爬取的网页进行分析 起初都对自己想要爬取数据进行分析 对就是这东西这是从fiddler获取出来我想要的内容网址 就是这个到了这一步下面就通过你代码吧 阅读全文
posted @ 2018-05-22 19:29 纯情 阅读(125) 评论(0) 推荐(0)
摘要://我先准备一个记事本准备页面网址 s=页数 q=搜索值 //爬取相对的网页数据 //找到图片的网址在源代码中ctrl+f 找到TB1xjf5dFhM8kjiszfwxxcib的代码复制用正则精准爬取 //遍历结果 import urllib.requestimport resuo="夹克男"key 阅读全文
posted @ 2018-05-21 14:52 纯情 阅读(176) 评论(0) 推荐(0)
摘要:代理网址 http://www.xicidaili.com urllib.request.ProxyHandler({"http":端口}) //代理操作 urllib.request.build_opener(代理名,urllib.request,HTTPHandler) import urlli 阅读全文
posted @ 2018-05-21 08:09 纯情 阅读(185) 评论(0) 推荐(0)
摘要:import urllib.request #导入模块 url="路径" #路径file=("值1","值2") #伪装成浏览器值dom=urllib.request.build_opener()dom.addheaders=[file]her=dom.open(url).read()tc=open 阅读全文
posted @ 2018-05-19 18:51 纯情 阅读(105) 评论(0) 推荐(0)
摘要:http和https的区别: http:是属于网页一种协议,而https也是网页协议,他们的区别在与版本不同,https是属于安全版本有相关的安全证书所以有些资料是访问不到的 而http就是取反 //模拟get请求 urllib.request.Request("相关路径") //对中文编码进行处理 阅读全文
posted @ 2018-05-19 12:40 纯情 阅读(96) 评论(0) 推荐(0)
摘要:对于urllib中我们先需要导入你想实用的类 import urllib 一般需要爬取信息等 import urllib.request 或 from urllib import request ,当程序导入完 我们先说说 urllib 下一些常用的方法吧 比如说: urllib.request.u 阅读全文
posted @ 2018-05-18 11:00 纯情 阅读(104) 评论(0) 推荐(0)
摘要:import reimport urllib.requeststring='<div class="name">(.*?)</div>'huo=urllib.request.urlopen("https://read.douban.com/provider/all").read()huo=huo.d 阅读全文
posted @ 2018-05-17 19:25 纯情 阅读(208) 评论(0) 推荐(0)
摘要:import pyexcel as ct#先导入需要操作excel表格的模块excel=ct.get_book_dict(file_name="D:\he.xlsx")excel2=ct.get_book_dict(file_name="D:\eh.xlsx")#获取两个表信息vor=[]wen=[ 阅读全文
posted @ 2018-05-17 16:59 纯情 阅读(949) 评论(0) 推荐(0)