python爬虫之网页解析

时间:2024-12-13 16:34:02

CSS Selector 与Xpath

path = ‘D:\\Postgraduate\\Python\\python_projects\\Python视频 分布式 爬虫Scrapy入门到精通\\第04python爬虫系统教程_免费赠送\\第1周\\week1\\1_2\\1_2code_of_video\\web\\new_index.html'

CSS Selector: 谁,在哪,第几个,长什么样

body > div.main-content > ul > li:nth-child(1) > img

XPath: 谁,在哪,第几个

/html/body/div[2]/ul/li[1]/img