python,xml.etree,使用命名空间解析 XML

时间:2021-01-27 13:39:18

标签: python xml elementtree xml-namespaces

我有这样的东西

for country in root.findall('{urn:oasis:names:tc:opendocument:xmlns:office:1.0}body/{urn:oasis:names:tc:opendocument:xmlns:office:1.0}text/{urn:oasis:names:tc:opendocument:xmlns:table:1.0}table/{urn:oasis:names:tc:opendocument:xmlns:table:1.0}table-row/{urn:oasis:names:tc:opendocument:xmlns:table:1.0}table-cell'):

我怎样才能缩短它?

{urn:oasis:names:tc:opendocument:xmlns:office:1.0}body

{urn:oasis:names:tc:opendocument:xmlns:table:1.0}table-cell

不同,在“办公室”和“桌子”

0 个答案:

没有答案
相关问题