📅  最后修改于: 2022-03-11 14:45:10.872000             🧑  作者: Mango
import xmltodict as xtd
import os
xml_file_content = ""
catalog_dir = os.chdir('directory')
catalog_dir_array = os.listdir(catalog_dir)
if("nameOfFile.xml" in catalog_dir_array):
catalog_file_content = open("nameOfFile.xml", "r").read()
catalog_file_content_dict = xtd.parse(catalog_file_content)