python lxml 抓取结果为空白

python lxml scraping giving blank result

我已经试过了,但得到的结果是空白

import requests

from lxml import html

response=requests.get('http://www.convertit.com/Go/ConvertIt/Currency/Convert_All_Output.ASP?FCu=USD')

tree = html.fromstring(response.text)

print (tree.xpath('//div/table/tbody/tr[41]/td[1]/text()'))

就像lol4t0在评论里说的,源码里没有tbody。如果您将最后一行更改为 read

print (tree.xpath('//div/table/tr[41]/td[1]/text()'))

您将得到 ['62.525'] 的结果。