摘要: 错误信息:selenium.common.exceptions.WebDriverException: Message: unknown error: Could not remove old devtools port file. Perhaps the given user-data-dir a 阅读全文
posted @ 2021-06-17 15:22 布都御魂 阅读(371) 评论(0) 推荐(0)
摘要: from lxml import etree# 实例化一个etree对象# 读取本地文档tree = etree.parse('html_prac.html')# 读取网络文档# html = etree.HTML(html)'''# 子节点/和子孙节点//定位# 从根节点进行定位tree1 = t 阅读全文
posted @ 2021-06-16 11:14 布都御魂 阅读(69) 评论(0) 推荐(0)
摘要: """author:张鑫date:2021/6/11 15:47"""import randomimport relist1 = [ 'a', '1', 'A', 'b', '2', 'B', 'c', '3', 'C', 'd', '4', 'D',]'''# 循环写入for i in range 阅读全文
posted @ 2021-06-15 17:05 布都御魂 阅读(50) 评论(0) 推荐(0)
摘要: '''csv写入方式:字典或者逐行写入csv第一行一般为字段csv读取使用for遍历csv文件读写需要特殊设置,例如:换行符,分隔符,写入与读取要设置一致。'''import pandas as pd# # a和b的长度必须保持一致,否则报错# a = [x for x in range(5)]# 阅读全文
posted @ 2021-06-15 17:04 布都御魂 阅读(59) 评论(0) 推荐(0)
摘要: 免费代理的网站: http://www.xicidaili.com/nn/ 代码部分: import requestsproxy='124.243.226.18:8888' #如果代理需要验证,只需要在前面加上用户名密码,如下所示 # proxy='username:password@124.243 阅读全文
posted @ 2021-06-15 16:52 布都御魂 阅读(2405) 评论(0) 推荐(0)
摘要: 错误:'pandas' has no attribute 'DataFrame' 解决方法:文件名不能是csv.py 保存文件名不能是csv.csv 阅读全文
posted @ 2021-06-11 17:13 布都御魂 阅读(47) 评论(0) 推荐(0)
摘要: 错误:requests.exceptions.ProxyError: HTTPSConnectionPool(host='www.baidu.com', port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot 阅读全文
posted @ 2021-06-11 09:47 布都御魂 阅读(174) 评论(0) 推荐(0)
摘要: import reimport requestsimport timeimport randomfrom selenium import webdriverfrom tools.headers import headersfor item in range(1, 100): time.sleep(r 阅读全文
posted @ 2021-06-10 17:13 布都御魂 阅读(152) 评论(0) 推荐(0)
摘要: 1.ip被封。2.http的连接数超过最大限制。headers的Connection参数默认为keep-alive,导致之前所有的链接都一直存在,占用了后续的链接请求。3.网站服务器太差,爬取请求的速度太快。(我的就是这样)解决方案:1.换ip,更换headers或者使用代理ip。2.将Connec 阅读全文
posted @ 2021-06-10 16:13 布都御魂 阅读(7427) 评论(0) 推荐(0)
摘要: 1.首先排除网络问题 2.打开host:C:\Windows\System32\drivers\etc在最后加上添加192.30.253.112 github.com192.30.253.119 gist.github.com151.101.100.133 assets-cdn.github.com 阅读全文
posted @ 2021-06-10 14:48 布都御魂 阅读(860) 评论(0) 推荐(0)