使用python代码我无法从名称标签中获取值ethernet1 / 1?它只返回值条目
<response status="success">
<result>
<hw>
<entry>
<name>ethernet1/1</name>
<duplex>full</duplex>
<type>0</type>
<state>up</state>
<st>1000/full/up</st>
<mac>00:1s:15:22:05:45</mac>
<mode>(autoneg)</mode>
<speed>1000</speed>
<id>16</id>
</entry>
for interface in hwintmarkup.find_all("entry"):
interfaced={'name':interface.name,
'duplex':str(interface.duplex.get_text()),
'state':str(interface.state.get_text()),
'mac':str(interface.mac.get_text()),
}
答案 0 :(得分:1)
name
是保留变量以获取当前标记名称。你必须使用这样的东西:
interface.find('name')