Answer the question
In order to leave comments, you need to log in
lxml parsing library
The problem with parsing the "link" tag in the lxml library The
actual code:
import lxml.html
xml = '<link>trololo</link>'
doc = lxml.html.document_fromstring(xml)
out = doc.cssselect('link')[0]
print out.text
None
Answer the question
In order to leave comments, you need to log in
syschel prompted a very good idea: I'm parsing xml with an html module)
Solution:
from lxml import etree
doc = etree.XML('<link>trololo</link>')
out = doc.xpath('/link')[0].text
print out
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question