What's the best way to parse HTML/XML with Python lxml? or Python lxml: How do you handle namespaces

18 Replies, 1566 Views

I'm team BeautifulSoup all the way! Yeah, python lxml is faster, but BS4 just *clicks* for me. The way it handles messy HTML is a lifesaver, and the docs are so clear even my cat could probably figure it out (ok, maybe not).

If speed is *that* critical, sure, go lxml. But for most scraping tasks, BS4 + requests is more than enough. Plus, you can slap on `lxml` as the parser backend in BS4 for a speed boost. Best of both worlds!

Pro tip: Check out `parsel` if you want XPath with a BS4-like vibe.

Messages In This Thread



Users browsing this thread: 1 Guest(s)