带嵌套标记结构的XML到Python数据帧

2024-06-28 20:02:17 发布

您现在位置:Python中文网/ 问答频道 /正文

我在结构中有一个巨大的XML,如下图所示。我需要把它解析成一个数据帧。我的数据帧将包含FinInstrmGnlAttrbts_IDFinInstrmGnlAttrbts_FullName等列。 我不知道如何在Python中遍历XML标记结构。你知道吗

import xml.etree.ElementTree as et
_xt = et.parse("DLTINS_20171019_01of01.xml")
_xr = _xt.getroot()
_xr
for child in _xr:
    print (child.tag, child.attrib)

它给了我

{urn:iso:std:iso:20022:tech:xsd:head.003.001.01}Hdr {}
{urn:iso:std:iso:20022:tech:xsd:head.003.001.01}Pyld {}

XML Structure I want to pass


Tags: 数据idchildisoxml结构techet