摘要: 阅读全文
posted @ 2021-03-29 20:49 路人刘 阅读(27) 评论(0) 推荐(0)
摘要: 这是一个分享表情包的帖子,把里面的表情爬了出来import requestsfrom lxml import etreeimport osurl = 'https://www.zhihu.com/question/329525297/answer/1449023611'headers = {'Use 阅读全文
posted @ 2021-02-11 21:27 路人刘 阅读(167) 评论(0) 推荐(0)
摘要: 过年休息。。。。。。 阅读全文
posted @ 2021-02-08 22:13 路人刘 阅读(22) 评论(0) 推荐(0)
摘要: 显示等待 import timefrom selenium import webdriverdriver = webdriver.Chrome(executable_path='C:\Program Files\Google\Chrome\Application\chromedriver.exe') 阅读全文
posted @ 2021-02-07 21:30 路人刘 阅读(50) 评论(0) 推荐(0)
摘要: import timefrom selenium import webdriverdriver = webdriver.Chrome(executable_path='C:\Program Files\Google\Chrome\Application\chromedriver.exe')# dri 阅读全文
posted @ 2021-02-06 22:08 路人刘 阅读(45) 评论(0) 推荐(0)
摘要: 爬取贴吧的标题和链接import requestsfrom lxml import etreeclass Tieba(object): def __init__(self, name): self.url = "https://tieba.baidu.com/f?kw={}&ie=utf-8&pn= 阅读全文
posted @ 2021-02-05 14:20 路人刘 阅读(73) 评论(0) 推荐(0)
摘要: 今天很崩溃,安装lxml包不会安装,基础很重要啊,实践也很重要,我先去安装包了。 from lxml import etree# text = '''<div><div>'''# html = etree.HTML(text)# ret_list = html.xpath("Xpath语法规则字符串 阅读全文
posted @ 2021-02-04 22:05 路人刘 阅读(31) 评论(0) 推荐(0)
摘要: # jsonpath'''jsonpath可以按照key对python字典进行批量数据提取file->设置->项目->项目解释器->+->搜索from jsonpath import jsonpathret = jsonpath(a, 'jsonpath语法规则字符串')$ 根节点。子节点。。内部任 阅读全文
posted @ 2021-02-03 22:14 路人刘 阅读(52) 评论(0) 推荐(0)
摘要: import requestsimport redef login(): # session session = requests.session() # headers session.headers = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; 阅读全文
posted @ 2021-02-02 21:17 路人刘 阅读(89) 评论(0) 推荐(0)
摘要: 超时参数timeout的使用 import requestsurl = 'https://twitter.com'response = requests.get(url, timeout=3)代理ip url = 'https://www.baidu.com'# response = request 阅读全文
posted @ 2021-02-02 20:37 路人刘 阅读(55) 评论(0) 推荐(0)