0
我假设将从我的脚本派生的数据保存到xml中。我需要自动化它。想想看是否有数组,所以我需要将这个数组的项目自动添加到xml中作为它的元素。有没有办法做到这一点。自动生成Python xml代码
这是用于将数据传递到XML
if score >= 0.4:
print('%s (score = %.5f)' % (human_string, score))
predicted_list.append(human_string)
print (image)
data_management.create_xml.write_xml(predicted_list, image)
这里我的Python脚本是我的XML生成代码
def write_xml(predicted_list, frameno):
root = ET.Element("root")
doc = ET.SubElement(root, "test")
ET.SubElement(doc, frameno, name="frame").text = predicted_list
tree = ET.ElementTree(root)
tree.write("/opt/lampp/htdocs/video_frames/test.xml")