Python BeautifulSoup的使用
发布日期:2022-04-02 18:15:32 浏览次数:10 分类:博客文章

本文共 317 字,大约阅读时间需要 1 分钟。

2017-07-24 22:39:14 

Python3 中的beautifulsoup引入的包是bs4

import requestsfrom bs4 import *r = requests.get('http://jwc.seu.edu.cn/')soup = BeautifulSoup(r.text,'html.parser')#prettify()函数可以将html以易读的形式展现出来print(soup.prettify())#find_all(tag) 返回所有的tag,可以使用字典的索引方式进行查找到你需要的东西for k in soup.find_all('link'):    print(k['href'])

 

转载地址:https://www.cnblogs.com/hyserendipity/p/7231611.html 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:Python 网络编程和Socket
下一篇:监督学习--k近邻算法

发表评论

最新留言

路过按个爪印,很不错,赞一个!
[***.219.124.196]2024年04月02日 23时42分30秒