可以利用 pip 来安装:

pip install beautifulsoup4

源代码:

import requests
r = requests.get("https://python123.io/ws/demo.html")
r.text
demo = r.text
from bs4 import BeautifulSoup
soup = BeautifulSoup(demo , "html.parser")
print(soup.prettify())

原网页,右键查看源代码:
在这里插入图片描述
利用爬虫执行之后:
在这里插入图片描述
可以看到树形的代码结构!

技术参考文档:https://cuiqingcai.com/1319.html

相关文章:

  • 2021-12-15
  • 2021-11-17
  • 2018-10-30
  • 2021-11-09
  • 2021-08-05
  • 2021-05-30
  • 2021-08-05
  • 2021-08-03
猜你喜欢
  • 2021-08-05
  • 2021-08-05
  • 2021-12-13
  • 2021-07-06
  • 2021-08-05
  • 2021-06-06
相关资源
相似解决方案