4 ms·
See http://www.jgc.org/blog/2009/11/parsing-html-in-python-with.html http://www.jgc.org/blog/2009/11/parsing-html-in-python-with.... and http://news.ycombinator
by drtse4 17y ago
See http://www.jgc.org/blog/2009/11/parsing-html-in-python-with.html http://www.jgc.org/blog/2009/11/parsing-html-in-python-with.... and http://news.ycombinator.com/item?id=923775 http://news.ycombinator.com/item?id=923775 .
Btw, as someone that has sometimes parsed html using regular expressions (for small and localized html snippets extracted by bigger pages) and has dealt with the numerous patches needed everytime something changes (structural changes or random \n,\r,etc... added to the source html ), i definitely agree that a html/xhtml parser is the way to go.
The resulting implementation will be cleaner and the typical issues will be adressed slightly changing the parsing code or fixing bugs in the html cleaning/validator section of the parser...