2024-04-20 05:26:14 发布
网友
如果我们在Google搜索框中输入一个搜索词,它会返回如下内容:
About x results (y seconds)
如何使用python3从搜索结果中提取这一行? 谢谢你的帮助。在
使用^{}(和^{}):
>>> import urllib.request >>> import lxml.html >>> html = .. urllib.request.urlopen .. http://www.google.com/search?q=python .. .read() >>> root = lxml.html.fromstring(html) >>> div, = root.cssselect('#resultStats') >>> div.text_content().strip() 'About 46,600,000 results (0.17 seconds)'
使用^{} (和^{} ):
相关问题 更多 >
编程相关推荐