Python 2 v.3 xpath

时间:2015-02-27 13:28:58

标签: python python-3.x xpath lxml

此代码返回Python 2.7.9下的一个元素,3.4.3下没有元素。为什么?我如何修复Python 3?

import requests
from lxml import html

page = requests.get('http://www.bloomberg.com/markets/rates-bonds/government-bonds/us/').text
tree = html.fromstring(page)

line = tree.xpath('//table[@class="std_table_module dual_border_data_table clear"][2]')
print(line)

0 个答案:

没有答案