官术网_书友最值得收藏!

  • Web Scraping with Python
  • Richard Lawson
  • 208字
  • 2021-07-09 21:28:50

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "Most websites define a robots.txt file to let robots know any restrictions about crawling their website."

A block of code is set as follows:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url><loc>http://example.webscraping.com/view/Afghanistan-1</loc></url>
  <url><loc>http://example.webscraping.com/view/Aland-Islands-2</loc></url>
  <url><loc>http://example.webscraping.com/view/Albania-3</loc></url>
  ...
</urlset>

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

def link_crawler(..., scrape_callback=None):
         …
         links = []
 if scrape_callback:
 links.extend(scrape_callback(url, html) or [])
         ...

Any command-line input or output is written as follows:

$ python performance.py 
Regular expressions: 5.50 seconds
BeautifulSoup: 42.84 seconds
Lxml: 7.06 seconds

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: " When regular users open this web page in their browser, they will enter their e-mail and password, and click on the Log In button to submit the details to the server."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

主站蜘蛛池模板: 大厂| 黄山市| 墨玉县| 墨玉县| 舟曲县| 宜良县| 子洲县| 临湘市| 黄石市| 宜城市| 五河县| 泽普县| 克拉玛依市| 武安市| 余庆县| 海安县| 台东市| 茌平县| 仁化县| 内丘县| 泸溪县| 大余县| 沙湾县| 黑龙江省| 喀什市| 河间市| 大英县| 河津市| 邹城市| 盐池县| 哈尔滨市| 安泽县| 潜江市| 新乡县| 陆川县| 遂宁市| 万盛区| 乌苏市| 香河县| 若尔盖县| 昆明市|