Quote:
Originally Posted by kovidgoyal
dont use beautiful soup, use lxml.
|
Thanks, Kovid.
I tried selecting an attribute, but still doesn't work:
Code:
from calibre.ebooks.oeb.polish.parsing import parse
snippet = "<section xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" epub:type="epigraph">"
root = parse(snippet)
if 'epub:type' in root.attrib:
epub_type = root.attrib['epub:type']
I want epub_type to read the 'epigraph' attribute.