Skip to content

Instantly share code, notes, and snippets.

@ianpreston
Created May 8, 2015 15:35
Show Gist options
  • Save ianpreston/5c65bc9d03eacda516b3 to your computer and use it in GitHub Desktop.
Save ianpreston/5c65bc9d03eacda516b3 to your computer and use it in GitHub Desktop.
lol lxml
In [1]: import lxml.html
In [2]: import requests
In [3]: x = """<?xml version="1.0" encoding="utf-8"?><sitemap><changefreq>Hello world</changefreq></sitemap>"""
In [4]: a = lxml.html.fromstring(x)
In [5]: a
Out[5]: <Element sitemap at 0x10517d050>
In [6]: b = lxml.html.fromstring('')
File "<string>", line unknown
XMLSyntaxError: line 1: Tag changefreq invalid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment