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")