我试图只打印XML树中一个字段的值,这是XML树(例如,当我请求它时得到的)
<puco>
<resultado>OK</resultado>
<coberturaSocial>O.S.P. TIERRA DEL FUEGO(IPAUSS)</coberturaSocial>
<denominacion>DAMIAN GUTIERREZ DEL RIO</denominacion>
<nrodoc>32443324</nrodoc>
<rnos>924001</rnos>
<tipodoc>DNI</tipodoc>
</puco>
现在,我只想打印“coberturaSocial”值,这里是我在视图.py公司名称:
^{pr2}$如果我打印“asd”,就会得到一个错误:视图没有返回HttpResponse对象。它没有返回任何结果。 在控制台里我也看到了这个 我只想打印coberturaSocial,请帮忙,新的xml解析!在
您需要提取标记的内容,然后将其包装在响应中返回,如下所示:
我猜
etree
是import xml.etree.ElementTree as etree
您可以使用:
相关问题 更多 >
编程相关推荐