使用urllib和BeautifulSoup怕取维基百科的数据
来源:互联网 发布:smt贴片机编程 编辑:程序博客网 时间:2024/06/15 12:10
urllib是python3常用的一个网络链接库
BeautifulSoup是一个对文档操作的第三方库
from urllib.request import urlopenfrom bs4 import BeautifulSoupimport re#获取维基百科页面的数据resp = urlopen('https://en.wikipedia.org/wiki/Main_Page').read().decode('utf-8')#使用BeautifulSoup取解析维基百科页面soup = BeautifulSoup(resp,'html.parser')#使用正则表达式找出所有wiki字条urlList = soup.findAll('a',href=re.compile('^/wiki/'))for url in urlList: if not re.search('\.(jpg|JPG)$',url['href']): print(url.get_text(),'------','https://en.wikipedia.org' + url['href']) pass
0 0
- 使用urllib和BeautifulSoup怕取维基百科的数据
- 利用urllib和BeautifulSoup爬取维基百科的词条
- 用urllib和BeautifulSoup获取维基百科词条信息
- 用urllib、BeautifulSoup抓取糗事百科段子
- Python使用urllib库和BeautifulSoup库爬虫总结
- 使用BeautifulSoup模块获取糗事百科上的笑话
- urllib/urllib2和BeautifulSoup爬虫学习
- BeautifulSoup的安装和使用
- python的【爬虫】:使用urllib爬取wiki文章,使用beautifulSoup解析html
- 使用BeautifulSoup爬取药智标准网的数据
- urllib和urllib2的区别和使用
- python BeautifulSoup 的安装和使用
- BeautifulSoup的安装和基本使用方式
- urllib 与 requests 分别搭配 beautifulsoup 的不同写法
- urllib和webbrowser使用
- 转载:使用 mechanize 和 BeautifulSoup 收集 Web 数据
- 使用BeautifulSoup对糗事百科热门进行爬取
- urllib/urllib2的使用
- Mysql-分页查询优化
- 普通最大子段和
- Java中普通代码块,构造代码块,静态代码块区别及代码示例
- 理解 Keystone 的四种 Token
- 精通二叉排序树
- 使用urllib和BeautifulSoup怕取维基百科的数据
- Leetcode刷题记——32. Longest Valid Parentheses(最长有效括号)
- JAVA IO流的操作-----将一个文件夹中Html文件转为JSP文件
- java中异或^运算符的运用
- linux install mysql
- 包含RecyclerView的module导入项目出现的问题
- 面对机会,最缺的是把握
- SQLite导出整个数据库/导出某个表到SQL文件
- new operator,operator new and replacement new