简单python爬虫
来源:互联网 发布:wbs 协作软件 编辑:程序博客网 时间:2024/04/27 18:51
import osimport urllibimport urllib.request as requestfrom bs4 import BeautifulSoupdef catch(url): f = open('filename.txt','w') response = request.urlopen(url) html = response.read() soup = BeautifulSoup(html) for list in soup.find_all('h3'): if list.string: f.writelines(list.string) else: f.write('\n') f.close()if __name__ == '__main__': print("""----------------loading code...---------------- """)url = '爬取的网址'catch(url)
用于爬取指定网页的python3语法爬虫,并且将制定爬取的信息保存到指定的文件夹的txt文件下,这是第一个爬虫程序,参考了博友的博客代码,高效简洁,可作为入门小程序
0 0
- python爬虫入门简单爬虫
- python-简单爬虫
- 简单python爬虫
- Python简单爬虫
- python 简单爬虫
- 简单python爬虫
- Python简单的爬虫
- Python简单爬虫
- python 简单爬虫实现
- python简单文本爬虫
- python超级简单爬虫
- python简单爬虫
- python简单爬虫程序
- python简单爬虫
- Python开发简单爬虫
- Python简单爬虫
- python 简单爬虫原理
- python 3 简单爬虫
- OXY OPENCART 商城自适应主题模板 ABC-0020-01
- 17. Letter Combinations of a Phone Number
- OJ第三批——Problem O:B C++时间类的运算符重载
- 使用Fitnesse进行接口自动化测试
- iOS中使用UITableView加载数据项
- 简单python爬虫
- 消息处理机制之Handler
- 孕妇好的软件有哪些 孕妇软件哪个好 孕妇软件
- 黑马程序员——Objective-C语言知识整理——构造方法相关知识总结
- Android等图标制作站点
- 初次使用游标
- Android wiki:01.PackageManager获得清单文件中的所有信息
- tabBar中tabBarItem选中颜色自定义设置
- Oracle下基础表(创建表/添加列/更改字段类型/删除字段/修改字段名/ 修改表名/删除表)