我是使用python的新手(只是学习)。我尝试使用python完成的任务是:要解析1个文件夹中的许多xml文件 - 每个xml文件的结构都相同。我想将所有这些数据写入1个大型csv文件。 CSV文件的标题将是xml文件的属性。
以下是1个xml文件的示例:
<?xml version='1.0' encoding='UTF-8' ?>
<XACTDOC>
<XACTNET_INFO
transactionId = "0254XLM"
origTransactionId = "0254XLM"
carrierExternalUniqueId = "6533277"
carrierId = "2570210"
carrierName = "Company_Name"
contractorName = "ContractorSoenSo"
recipientsXNAddress = "text"
recipientsName = "moreText"
>
<CONTROL_POINTS>
<CONTROL_POINT
stamp = "2014-10-20T16:02:08"
createdStamp = "2014-10-20T16:02:08"
type = "Notification Pending"
status = "2"
/>
</CONTROL_POINTS>
</XACTNET_INFO>
<CONTACTS/>
<ADM>
<COVERAGE_LOSS
claimNumber = "123456-78"
/>
</ADM>
</XACTDOC>
你能提供的任何帮助都会很棒!