1 Star 0 Fork 0

dbembed/PythonLearn

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
learnrequesthtml.py 547 Bytes
一键复制 编辑 原始数据 按行查看 历史
from requests_html import HTMLSession
session = HTMLSession()
response = session.get('https://python.org/')
print(response.html.links)
print('#'*10)
print(response.html.absolute_links)
print('#'*10)
about = response.html.find('#about', first=True)
print(about.text)
print('#'*10)
print(about.attrs)
print('#'*10)
print(about.html)
print('#'*10)
print(about.absolute_links)
print('#'*10)
r = session.get('https://github.com/')
sel = '#js-pjax-container > div.shelf.intro-shelf.js-notice > div > div > p'
print(r.html.find(sel, first=True).text)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/dbembed/PythonLearn.git
git@gitee.com:dbembed/PythonLearn.git
dbembed
PythonLearn
PythonLearn
master

搜索帮助