【发布时间】:2011-06-21 09:07:46
【问题描述】:
对于给定的元素,我想检查 xsi:nil 属性是否设置为 true。
我当前的代码是
xsinil = dataFact.get('{http://www.w3.org/2001/XMLSchema-instance}nil', False)
但不是True xsinil 是字符串类型...
最好的解决方案是什么?我不认为这很优雅:
xsinil=dataFact.get('{http://www.w3.org/2001/XMLSchema-instance}nil', False)
if xsinil == 'true' or xsinil == '1' :
xsinil = True
【问题讨论】:
标签: python lxml elementtree