[英]xml.etree.ElementTree findall() not behaving as expected
>>> import xml.etree.ElementTree as ET
>>> t = ET.fromstring('<root><field name="tcp.option_len" ></field></root>')
>>> t.findall('.//field [@name="tcp.option_len"]')
[]
为什么不返回该field
?
只需删除XPath查询b / n字段和方括号[
t.findall('.//field[@name="tcp.option_len"]')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.