【发布时间】:2017-06-04 00:03:04
【问题描述】:
我有这样结构的文件:
<pwACL>
The gateway only supports upto 10 rules.
</pwACL>
<cmn53>
Batch Number
</cmn53>
我想获取标签名称和标签之间的数据。我尝试使用 BeatifulSoup HTMLParser 库,但它会自动将标签名称转换为小写。我发现可以像这样使用 html5lib 和 beatifulsoup 树生成器来创建树:
parser = html5lib.HTMLParser(tree=treebuilders.getTreeBuilder("beatifulsoup"))
但似乎 html5lib 不再支持 beatifulsoup 了。有没有其他办法?
【问题讨论】:
标签: python xml beautifulsoup