Skip to content

Instantly share code, notes, and snippets.

@lqc
Created March 5, 2010 19:50
Show Gist options
  • Select an option

  • Save lqc/323066 to your computer and use it in GitHub Desktop.

Select an option

Save lqc/323066 to your computer and use it in GitHub Desktop.
from lxml import etree
DOC = """<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl">
<head>
<title>{}</title>
</head>
<body>
<ul id="menu"></ul>
<ul xml:id="posty"></ul>
</body>
</html>"""
doc = etree.parse(DOC)
menu = doc.find(".//*[@id='menu']")
posty = doc.find(".//*[@{http://www.w3.org/XML/1998/namespace}id='posty']")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment