Skip to Content
Python数据处理
book

Python数据处理

by Jacqueline Kazil, Katharine Jarmul
July 2017
Intermediate to advanced
398 pages
11h 54m
Chinese
Posts & Telecom Press
Content preview from Python数据处理
221
11
网页抓取:获取并存储网络数据
网页抓取是当今世界数据挖掘中必不可少的一部分,因为你几乎可以在网络上找到任何事
物。有了网页抓取,你可以使用
Python
库来探索
Web
页面、搜索信息并收集它们以撰写
报告。网页抓取让你爬取站点,发现在没有机器人协助的情况下不容易获取的信息。
这项技术使你能够获取
API
或文档之外的数据。想象一个脚本登录你的
E-mail
账户,下载
文件,运行分析,并且发送一个整合的报告。想象一下不用使用浏览器就可以测试站点,
以确定它具备完整的功能。想象一下从一个定期更新的网站的一系列表格中抓取数据。这
些示例展示了网页抓取如何能帮助你完成数据处理的需求。
根据爬取内容的不同——本地或公开站点,
XML
文档——你可以使用很多相同的工具完
成这些任务。大多数网站在
HTML
代码中包含数据。
HTML
是一种标记语言,使用括号
(类似于第
3
章中的
XML
示例)来包含数据。在这一章,我们会使用一些能够解析和读取
HTML
XML
等标记语言的库。
很多站点使用内部的
API
和嵌入的
JavaScript
脚本来控制页面上的内容。由于这些构建站
点的新方式,并不是所有的信息都能够使用读页面的抓取器找到。我们还会学习如何使用
一些读屏幕的
Web
抓取器,应对拥有多个数据源的站点。根据站点的组成,你可能同样可
以连接
API
;在第
13
章你会了解更多有关
API
的信息。
11.1
 抓取什么和如何抓取
网页抓取为数据收集带来了无限可能。在互联网上有成千上万的站点,拥有可能会在项目
中使用的各种各样的内容和数据。为了构建一个认真负责的网页抓取器,要熟悉每一个站 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

数据科学中的实用统计学(第2版)

数据科学中的实用统计学(第2版)

Peter Bruce, Andrew Bruce, Peter Gedeck
Java持续交付

Java持续交付

Daniel Bryant, Abraham Marín-Pérez
解密金融数据

解密金融数据

Justin Pauley

Publisher Resources

ISBN: 9787115459190