当他们说read(2)或open(1)时,有什么意思?括号中的数字实际上是什么意思?
编辑: 重新提出问题的标题。
答案 0 :(得分:7)
括号用于指定手册页的部分。手册页被组织成不同的部分,而部分编号指定了什么类型的"事物"它是。来自Wikipedia,一个常见的部门组织(在Research Unix,BSD,OS X和Linux上)是这样的:
namespace
例如,PSR-2
表示它正在讨论操作系统调用1 General commands
2 System calls
3 Library functions, covering in particular the C standard library
4 Special files (usually devices, those found in /dev) and drivers
5 File formats and conventions
6 Games and screensavers
7 Miscellanea
8 System administration commands and daemons
。
答案 1 :(得分:3)
它们是手册页部分标识符。你应该试试
import scrapy
class SomeSpider(scrapy.Spider):
name = 'spider_1'
start_urls = ['https://www.xxxxxx.xxx/xxxx-xxxx/xxxxxx']
def parse(self, response):
for element in response.xpath('//div/ul/li')[1:]: # skipped first list element used '[1:]'
element_href = element.xpath('a/@href').extract_first()
element_text = element.xpath('a/text()').extract_first().strip()
yield scrapy.Request(url=response.urljoin(element_href), callback=self.parse_element_1, meta = {'element': element_text})
def parse_element_1(self, response):
for element1 in response.xpath('//div/ul/li'):
element1_href = element1.xpath('a/@href').extract_first()
element1_text = element1.xpath('a/text()').extract_first().strip()
element = response.meta['element']
yield scrapy.Request(url=response.urljoin(element1_href), callback=self.parse_element_2, meta={'element': element, 'element1': element1_text})
def parse_element_2(self, response):
for element2 in response.xpath('//div'):
element2_href = element2.xpath('a/@href').extract_first()
element = response.meta['element']
element1 = response.meta['element1']
yield {
'element': element,
'element1': element1
}
或
scrapy crawl spider_1 -o scraped_data.json
查看这些标识符的特定版本。