摘要: 1、xpath解析网页源文件 from urllib import request from lxml import etree # 请求的url url = "http://www.dfenqi.cn/Product/Index" # 请求的头文件 headers = { "User-Agent" 阅读全文
posted @ 2018-03-21 16:45 toloy 阅读(1821) 评论(0) 推荐(0) 编辑
摘要: 1、首先下载登录官网:https://pypi.python.org/ ,搜索lxml 找到 lxml包 比如:lxml-4.2.0-cp36-cp36m-win32.whl (md5), 2、安装 wheel 工具 ,cmd -> pip install wheel 3、再安装lxml包 cmd 阅读全文
posted @ 2018-03-21 16:37 toloy 阅读(458) 评论(0) 推荐(0) 编辑
摘要: from urllib import request import re # 请求的url url = "http://www.dfenqi.cn/Product/Index" # 请求的头文件 headers = { "User-Agent": "Mozilla/5.0 (Windows NT 1 阅读全文
posted @ 2018-03-21 15:25 toloy 阅读(231) 评论(0) 推荐(0) 编辑
摘要: from urllib import request # 导入需要引用cookie的包 from http import cookiejar import urllib.parse # 请求的url url = "http://www.jinri.com" # 请求的头文件 headers = { 阅读全文
posted @ 2018-03-21 15:00 toloy 阅读(188) 评论(0) 推荐(0) 编辑
摘要: from urllib import request # 请求的url url = "http://www.jinri.com" # 请求的头文件 headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/ 阅读全文
posted @ 2018-03-21 14:05 toloy 阅读(442) 评论(0) 推荐(0) 编辑
摘要: from urllib import request url = "http://www.jinri.com" # 自定义handler handler = request.HTTPHandler() headers = { "User-Agent": "Mozilla/5.0 (Windows N 阅读全文
posted @ 2018-03-21 13:50 toloy 阅读(145) 评论(0) 推荐(0) 编辑