我使用lxml的解析,有一個Facebook的評論標籤,看起來像在HTML:蟒蛇LXML找到<FB:評論/>標籤
<fb:comments id="fb_comments" href="http://example.com" num_posts="5" width="600"></fb:comments>
我想選擇它來獲得HREF值,但是當我做了cssselect('fb:comments')
我得到以下錯誤:
The pseudo-class Symbol(u'comments', 3) is unknown
有沒有辦法做到這一點?
編輯: 代碼:
from lxml.html import fromstring
html = '...'
parser = fromstring(html)
parser.cssselect('fb:comments') #raises the exception
請提供您的python代碼。 –
@Secator代碼加入 – applechief