问题描述
xml文件包含返回值:
<!-- This xml is designed for testing -->
<returns>
<obs>0.008053735</obs>
<obs>0.004752907</obs>
<obs>0.004682267</obs>
<obs>0.003029358</obs>
</returns>
Python代码:
import xml.etree.ElementTree as ET
import numpy as np
r=[]
def LoadReturn():
try:
treexml = ET.parse('./sample_data/returns.xml')
root = treexml.getroot()
for ts in root:
r.append(ts.text)
except:
print("Failed to parse xml from response (%s)" % traceback.format_exc())
return r
我想删除XML的注释行。有谁知道该怎么做?
谢谢, L
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)