2013-11-01 31 views
7

我正在運行的Python 2.7.2 我有LXML和cssselect裝'lxml.etree._ElementTree' 對象有沒有屬性 'cssselect'

我的代碼是

from lxml import etree, html 
r = html.parse(start_url) 
all_titles = r.cssselect('span.titles') #should return a list of results 
all_urls = r.cssselect('span.links') #and this as well 

我刮網頁有標題和相關鏈接。

但我遇到這個錯誤: 「lxml.etree._ElementTree」對象有沒有屬性「cssselect」

回答