Sal
Peter Hoffmann Director Data Engineering at Blue Yonder. Python Developer, Conference Speaker, Mountaineer

Extracting info from html using PHP(XPath), PHP/Python(Regexp) or Python(XPath)

This my Answer to the stackoverflow question: Extracting info from html using PHP(XPath), PHP/Python(Regexp) or Python(XPath):

If speed is a requirement have a look at lxml. lxml is a pythonic binding for the libxml2 and libxslt C libraries. Using the C libraries is much faster than any pure php or python version.

There are some impressive benchmarks from Ian Bicking:

In Conclusion

I knew lxml was fast before I started these benchmarks, but I didn’t expect it to be quite this fast.

Parsing Results:

Parsing Resutls