Hello,
My XPath skills being what they are… in an HTML file, I can't figure out
how to grab the text of the second attribute in a meta element:
==================
with open("input.html") as tempfile:
parser = et.HTMLParser(remove_blank_text=True,recover=True)
currfile_tree = et.parse(tempfile, parser=parser)
currfile_root = currfile_tree.getroot()
"""
<head>
<title>Blah</title>
<meta name="description" content="HERE"/>
</head>'
"""
description=currfile_root.xpath("//meta[@name='description' and
@content]")
==================
Any idea?
Thank you.
_______________________________________________
lxml - The Python XML Toolkit mailing list -- lxml@python.org
To unsubscribe send an email to lxml-le...@python.org
https://mail.python.org/mailman3/lists/lxml.python.org/
Member address: arch...@mail-archive.com