当美丽的汤4看起来不适合解析时该怎么办?它无法找到输入

时间:2016-10-21 20:11:10

标签: python html beautifulsoup

我目前正在使用Beautiful Soup 4在Python 2.7.x上尝试通过按名称查找输入来解析旧的html页面,但Beautiful Soup不会返回我正在寻找的输入。它返回一堆其他代码,而不仅仅是" a_dev"隐藏的输入。我被引导相信它,因为html没有按照Beautiful Soup寻找的方式进行格式化;但是,html是有效的。我在这里错过了什么吗?

我试图获取名为" a_dev"的隐藏输入的值。

我的代码段在这里:

try:
    alarmPage = beautifulSoup(urllib2.urlopen(url, timeout=4).read(), 'html.parser')
    print '====== alarm page ======'
    print alarmPage
    print '====================='
    inputs = alarmPage.find_all("input", {"name":"a_dev"})
    print '====== alarms ======'
    print inputs
    print '====================='
    for i in inputs:
        print '========== i ==========='
        print i
        print '========== end i ========='

    return False, inputs
except urllib2.HTTPError as e:
    traceback.print_exc()
    return True, None
...

alarmPage =

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<link href="/ng.css" rel="stylesheet" type="text/css">
<script src="jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="ng.js" type="text/javascript"></script>
<title>MNNTMNJKGM1</title>
</link></meta></head>
<body>
<noscript style="color:#f00;">
<div>
<hr style="color:#00ff00;background-color:#00ff00;width:90%;height:3px;">
    This application requires that JavaScript be enabled.
    <hr style="color:#00ff00;background-color:#00ff00;width:90%;height:3px;">
    Please enable JavaScript in your browser.
    <hr style="color:#00ff00;background-color:#00ff00;width:90%;height:3px;">
</hr></hr></hr></div>
</noscript>
<div id="shadow-one"><div id="shadow-two"><div id="shadow-three"><div id="shadow-four">
<div id="page">
<div id="header">
<div id="logo"><img alt="Geist" src="/logo.png"/></div>
<div id="unitInfo">
<h2>MNNTMNJKGM1 </h2>
  IP Address: 10.252.22.134
  <br>
  Local Time: 2016-10-21 13:38:31
</br></div>
<div id="unitType">
<h2>BB100 <br>v1.4.3</br></h2>
</div>
<div id="allswell"><div class="data_clear">All is well: 3 Alarms Monitored</div></div>
<div class="spacer"></div>
</div>
<div class="menu">
<div class="munsel"><a href="/index.htm">Overview</a></div>
<div class="msel"><a href="/alarms.htm">Alarms</a></div>
<div class="munsel"><a href="/display.htm">Display</a></div>
<div class="munsel"><a href="/logging.htm">Logging</a></div>
<div class="munsel"><a href="/control.htm">Control</a></div>
<div class="munsel"><a href="/config.htm">Config</a></div>
<div class="munsel"><a href="http://www.geistglobal.com/support" target="_blank">Help</a></div>
<div class="malt"><a href="/data.xml">XML</a> | <a href="/mib.zip">MIB</a></div>
</div>
<div id="content">
<h1>Alarm settings</h1>
<div style="display:none">
<div class="sHead">
<span class="name">Error</span>
</div>
<div class="sBody">
<div class="error" style="text-align:center"><h3>There was an error with one or more parameters, please try again</h3></div>
<div style="text-align:center"></div>
</div>
</div>
<div class="sHead">
<span class="name">MNNTMNJKGM1</span>
<span class="id"></span>
</div><div class="sBody"><form action="/alarms.htm" method="post">
<input name="a_dev" type="hidden" value="0B0004A353FA9AC3">
<div class="divcolor2">
<input name="a_index" type="hidden" value="0">
<div class="alarmL">
<select name="a_meas" size="1" style="width:200px;">
<option value="-1">(REMOVE ALARM)</option><option selected="" value="0">Temperature</option>
<option value="1">Humidity</option>
<option value="2">Dewpoint</option>
<option value="3">Door Alarm</option>
<option value="4">-48 VDC Sensor</option>
<option value="5">AI3</option>
<option value="6">AI4</option>
</select>
<div>Trips if
<select name="a_trip" size="1" style="width:125px;">
<option value="0">Below</option>
<option selected="" value="1">Above</option>
</select></div>
<div>limit
<input maxlength="7" name="a_lim" style="width:100px;" type="text" value="120.00"/></div>
</div>
<div class="alarmS data_clear">CLEAR</div>
<div class="alarmBarV" style="top: 5px; left: 250px;"></div>
<div class="alarmR">
<div class="alarmSel">
<div>E-mail </div>
<label title="(Email 1)"><input name="a_act" type="checkbox" value="0"> (Email 1)</input></label>
<label title="(Email 2)"><input name="a_act" type="checkbox" value="1"> (Email 2)</input></label>
<label title="(Email 3)"><input name="a_act" type="checkbox" value="2"> (Email 3)</input></label>
<label title="(Email 4)"><input name="a_act" type="checkbox" value="3"> (Email 4)</input></label>
<label title="(Email 5)"><input name="a_act" type="checkbox" value="4"> (Email 5)</input></label>
<hr><div>SNMP Traps </div>
<label title="192.168.1.27"><input checked="" name="a_act" type="checkbox" value="5"> 192.168.1.27</input></label>
<label title="(Trap 2)"><input checked="" name="a_act" type="checkbox" value="6"> (Trap 2)</input></label>
<hr><div>Internal </div>
<label title="Relay1"><input name="a_act" type="checkbox" value="7"> Relay1</input></label>
</hr></hr></div>
</div>
<div class="alarmC">
<span>Alarm must remain tripped for
<input maxlength="3" name="a_del" size="3" style="width: 3em;" title="Delays taking any action until alarm is continuously tripped for this long (0 to 255 min)" type="text" value="0">
(min) before notification</input></span>
<div class="alarmBarH"></div>
<span>Repeat every:
<input maxlength="3" name="a_rep" size="3" style="width: 3em;" title="Repeats E-mails and traps until alarm is cleared (0 to 255 min)" type="text" value="1">
(min)</input></span>
</div><div class="alarmBarV" style="top: 5px; left: 470px;"></div>
<input name="a_close" type="hidden" value="1"/></input></div>
<div class="divcolor1">
<input name="a_index" type="hidden" value="1">
<div class="alarmL">
<select name="a_meas" size="1" style="width:200px;">
<option value="-1">(REMOVE ALARM)</option><option value="0">Temperature</option>
<option value="1">Humidity</option>
<option value="2">Dewpoint</option>
<option selected="" value="3">Door Alarm</option>
<option value="4">-48 VDC Sensor</option>
<option value="5">AI3</option>
<option value="6">AI4</option>
</select>
<div>Trips if
<select name="a_trip" size="1" style="width:125px;">
<option selected="" value="0">Below</option>
<option value="1">Above</option>
</select></div>
<div>limit
<input maxlength="7" name="a_lim" style="width:100px;" type="text" value="75.00"/></div>
</div>
<div class="alarmS data_clear">CLEAR</div>
<div class="alarmBarV" style="top: 5px; left: 250px;"></div>
<div class="alarmR">
<div class="alarmSel">
<div>E-mail </div>
<label title="(Email 1)"><input name="a_act" type="checkbox" value="0"> (Email 1)</input></label>
<label title="(Email 2)"><input name="a_act" type="checkbox" value="1"> (Email 2)</input></label>
<label title="(Email 3)"><input name="a_act" type="checkbox" value="2"> (Email 3)</input></label>
<label title="(Email 4)"><input name="a_act" type="checkbox" value="3"> (Email 4)</input></label>
<label title="(Email 5)"><input name="a_act" type="checkbox" value="4"> (Email 5)</input></label>
<hr><div>SNMP Traps </div>
<label title="192.168.1.27"><input checked="" name="a_act" type="checkbox" value="5"> 192.168.1.27</input></label>
<label title="(Trap 2)"><input checked="" name="a_act" type="checkbox" value="6"> (Trap 2)</input></label>
<hr><div>Internal </div>
<label title="Relay1"><input name="a_act" type="checkbox" value="7"> Relay1</input></label>
</hr></hr></div>
</div>
<div class="alarmC">
<span>Alarm must remain tripped for
<input maxlength="3" name="a_del" size="3" style="width: 3em;" title="Delays taking any action until alarm is continuously tripped for this long (0 to 255 min)" type="text" value="0">
(min) before notification</input></span>
<div class="alarmBarH"></div>
<span>Repeat every:
<input maxlength="3" name="a_rep" size="3" style="width: 3em;" title="Repeats E-mails and traps until alarm is cleared (0 to 255 min)" type="text" value="1">
(min)</input></span>
</div><div class="alarmBarV" style="top: 5px; left: 470px;"></div>
<input name="a_close" type="hidden" value="1"/></input></div>
<div class="divcolor2">
<input name="a_index" type="hidden" value="2">
<div class="alarmL">
<select name="a_meas" size="1" style="width:200px;">
<option value="-1">(REMOVE ALARM)</option><option selected="" value="0">Temperature</option>
<option value="1">Humidity</option>
<option value="2">Dewpoint</option>
<option value="3">Door Alarm</option>
<option value="4">-48 VDC Sensor</option>
<option value="5">AI3</option>
<option value="6">AI4</option>
</select>
<div>Trips if
<select name="a_trip" size="1" style="width:125px;">
<option selected="" value="0">Below</option>
<option value="1">Above</option>
</select></div>
<div>limit
<input maxlength="7" name="a_lim" style="width:100px;" type="text" value="4.00"/></div>
</div>
<div class="alarmS data_clear">CLEAR</div>
<div class="alarmBarV" style="top: 5px; left: 250px;"></div>
<div class="alarmR">
<div class="alarmSel">
<div>E-mail </div>
<label title="(Email 1)"><input name="a_act" type="checkbox" value="0"> (Email 1)</input></label>
<label title="(Email 2)"><input name="a_act" type="checkbox" value="1"> (Email 2)</input></label>
<label title="(Email 3)"><input name="a_act" type="checkbox" value="2"> (Email 3)</input></label>
<label title="(Email 4)"><input name="a_act" type="checkbox" value="3"> (Email 4)</input></label>
<label title="(Email 5)"><input name="a_act" type="checkbox" value="4"> (Email 5)</input></label>
<hr><div>SNMP Traps </div>
<label title="192.168.1.27"><input checked="" name="a_act" type="checkbox" value="5"> 192.168.1.27</input></label>
<label title="(Trap 2)"><input checked="" name="a_act" type="checkbox" value="6"> (Trap 2)</input></label>
<hr><div>Internal </div>
<label title="Relay1"><input name="a_act" type="checkbox" value="7"> Relay1</input></label>
</hr></hr></div>
</div>
<div class="alarmC">
<span>Alarm must remain tripped for
<input maxlength="3" name="a_del" size="3" style="width: 3em;" title="Delays taking any action until alarm is continuously tripped for this long (0 to 255 min)" type="text" value="1">
(min) before notification</input></span>
<div class="alarmBarH"></div>
<span>Repeat every:
<input maxlength="3" name="a_rep" size="3" style="width: 3em;" title="Repeats E-mails and traps until alarm is cleared (0 to 255 min)" type="text" value="0">
(min)</input></span>
</div><div class="alarmBarV" style="top: 5px; left: 470px;"></div>
<input name="a_close" type="hidden" value="1"/></input></div>
<div class="buttons"><input onclick="ITW.V.submitAlarms(this)" type="button" value="Save Changes">
<input name="a_new" onclick="ITW.V.submitAlarms(this)" type="button" value="Add New Alarm"/></input></div>
</input></form>
</div>
<!--End body-->
</div>
<div id="footer">
<div>
<div class="footer_left">
      Unit Location: MS14XC871
      <br>
      Unit Description: Environment Monitor
      <br>
      Admin: <a href="mailto:"> MNNTMNJKGM1</a> or Call
    </br></br></div>
<div class="footer_right">
      Support: <a href="http://www.geistglobal.com/support" target="_blank">Manuals, </a>
<a href="mailto:support@geistglobal.com">support@geistglobal.com</a> or Call 800.432.3219 / +1.402.474.3400
      <br>
      Copyright © 2003-2012 <a href="http://www.geistglobal.com" target="_blank">Geist</a> All Rights Reserved.
      <br>

    </br></br></div>
</div>
</div>
</div></div></div></div></div>
</body>

闹钟=

[<input name="a_dev" type="hidden" value="0B0004A353FA9AC3">\n<div class="divcolor2">\n<input name="a_index" type="hidden" value="0">\n<div class="alarmL">\n<select name="a_meas" size="1" style="width:200px;">\n<option value="-1">(REMOVE ALARM)</option><option selected="" value="0">Temperature</option>\n<option value="1">Humidity</option>\n<option value="2">Dewpoint</option>\n<option value="3">Door Alarm</option>\n<option value="4">-48 VDC Sensor</option>\n<option value="5">AI3</option>\n<option value="6">AI4</option>\n</select>\n<div>Trips if \r\n<select name="a_trip" size="1" style="width:125px;">\n<option value="0">Below</option>\n<option selected="" value="1">Above</option>\n</select></div>\n<div>limit \r\n<input maxlength="7" name="a_lim" style="width:100px;" type="text" value="120.00"/></div>\n</div>\n<div class="alarmS data_clear">CLEAR</div>\n<div class="alarmBarV" style="top: 5px; left: 250px;"></div>\n<div class="alarmR">\n<div class="alarmSel">\n<div>E-mail\xa0</div>\n<label title="(Email 1)"><input name="a_act" type="checkbox" value="0">\xa0(Email 1)</input></label>\n<label title="(Email 2)"><input name="a_act" type="checkbox" value="1">\xa0(Email 2)</input></label>\n<label title="(Email 3)"><input name="a_act" type="checkbox" value="2">\xa0(Email 3)</input></label>\n<label title="(Email 4)"><input name="a_act" type="checkbox" value="3">\xa0(Email 4)</input></label>\n<label title="(Email 5)"><input name="a_act" type="checkbox" value="4">\xa0(Email 5)</input></label>\n<hr><div>SNMP Traps\xa0</div>\n<label title="192.168.1.27"><input checked="" name="a_act" type="checkbox" value="5">\xa0192.168.1.27</input></label>\n<label title="(Trap 2)"><input checked="" name="a_act" type="checkbox" value="6">\xa0(Trap 2)</input></label>\n<hr><div>Internal\xa0</div>\n<label title="Relay1"><input name="a_act" type="checkbox" value="7">\xa0Relay1</input></label>\n</hr></hr></div>\n</div>\n<div class="alarmC">\n<span>Alarm must remain tripped for\r\n<input maxlength="3" name="a_del" size="3" style="width: 3em;" title="Delays taking any action until alarm is continuously tripped for this long (0 to 255 min)" type="text" value="0">\r\n(min) before notification</input></span>\n<div class="alarmBarH"></div>\n<span>Repeat every:\r\n<input maxlength="3" name="a_rep" size="3" style="width: 3em;" title="Repeats E-mails and traps until alarm is cleared (0 to 255 min)" type="text" value="1">\r\n(min)</input></span>\n</div><div class="alarmBarV" style="top: 5px; left: 470px;"></div>\n<input name="a_close" type="hidden" value="1"/></input></div>\n<div class="divcolor1">\n<input name="a_index" type="hidden" value="1">\n<div class="alarmL">\n<select name="a_meas" size="1" style="width:200px;">\n<option value="-1">(REMOVE ALARM)</option><option value="0">Temperature</option>\n<option value="1">Humidity</option>\n<option value="2">Dewpoint</option>\n<option selected="" value="3">Door Alarm</option>\n<option value="4">-48 VDC Sensor</option>\n<option value="5">AI3</option>\n<option value="6">AI4</option>\n</select>\n<div>Trips if \r\n<select name="a_trip" size="1" style="width:125px;">\n<option selected="" value="0">Below</option>\n<option value="1">Above</option>\n</select></div>\n<div>limit \r\n<input maxlength="7" name="a_lim" style="width:100px;" type="text" value="75.00"/></div>\n</div>\n<div class="alarmS data_clear">CLEAR</div>\n<div class="alarmBarV" style="top: 5px; left: 250px;"></div>\n<div class="alarmR">\n<div class="alarmSel">\n<div>E-mail\xa0</div>\n<label title="(Email 1)"><input name="a_act" type="checkbox" value="0">\xa0(Email 1)</input></label>\n<label title="(Email 2)"><input name="a_act" type="checkbox" value="1">\xa0(Email 2)</input></label>\n<label title="(Email 3)"><input name="a_act" type="checkbox" value="2">\xa0(Email 3)</input></label>\n<label title="(Email 4)"><input name="a_act" type="checkbox" value="3">\xa0(Email 4)</input></label>\n<label title="(Email 5)"><input name="a_act" type="checkbox" value="4">\xa0(Email 5)</input></label>\n<hr><div>SNMP Traps\xa0</div>\n<label title="192.168.1.27"><input checked="" name="a_act" type="checkbox" value="5">\xa0192.168.1.27</input></label>\n<label title="(Trap 2)"><input checked="" name="a_act" type="checkbox" value="6">\xa0(Trap 2)</input></label>\n<hr><div>Internal\xa0</div>\n<label title="Relay1"><input name="a_act" type="checkbox" value="7">\xa0Relay1</input></label>\n</hr></hr></div>\n</div>\n<div class="alarmC">\n<span>Alarm must remain tripped for\r\n<input maxlength="3" name="a_del" size="3" style="width: 3em;" title="Delays taking any action until alarm is continuously tripped for this long (0 to 255 min)" type="text" value="0">\r\n(min) before notification</input></span>\n<div class="alarmBarH"></div>\n<span>Repeat every:\r\n<input maxlength="3" name="a_rep" size="3" style="width: 3em;" title="Repeats E-mails and traps until alarm is cleared (0 to 255 min)" type="text" value="1">\r\n(min)</input></span>\n</div><div class="alarmBarV" style="top: 5px; left: 470px;"></div>\n<input name="a_close" type="hidden" value="1"/></input></div>\n<div class="divcolor2">\n<input name="a_index" type="hidden" value="2">\n<div class="alarmL">\n<select name="a_meas" size="1" style="width:200px;">\n<option value="-1">(REMOVE ALARM)</option><option selected="" value="0">Temperature</option>\n<option value="1">Humidity</option>\n<option value="2">Dewpoint</option>\n<option value="3">Door Alarm</option>\n<option value="4">-48 VDC Sensor</option>\n<option value="5">AI3</option>\n<option value="6">AI4</option>\n</select>\n<div>Trips if \r\n<select name="a_trip" size="1" style="width:125px;">\n<option selected="" value="0">Below</option>\n<option value="1">Above</option>\n</select></div>\n<div>limit \r\n<input maxlength="7" name="a_lim" style="width:100px;" type="text" value="4.00"/></div>\n</div>\n<div class="alarmS data_clear">CLEAR</div>\n<div class="alarmBarV" style="top: 5px; left: 250px;"></div>\n<div class="alarmR">\n<div class="alarmSel">\n<div>E-mail\xa0</div>\n<label title="(Email 1)"><input name="a_act" type="checkbox" value="0">\xa0(Email 1)</input></label>\n<label title="(Email 2)"><input name="a_act" type="checkbox" value="1">\xa0(Email 2)</input></label>\n<label title="(Email 3)"><input name="a_act" type="checkbox" value="2">\xa0(Email 3)</input></label>\n<label title="(Email 4)"><input name="a_act" type="checkbox" value="3">\xa0(Email 4)</input></label>\n<label title="(Email 5)"><input name="a_act" type="checkbox" value="4">\xa0(Email 5)</input></label>\n<hr><div>SNMP Traps\xa0</div>\n<label title="192.168.1.27"><input checked="" name="a_act" type="checkbox" value="5">\xa0192.168.1.27</input></label>\n<label title="(Trap 2)"><input checked="" name="a_act" type="checkbox" value="6">\xa0(Trap 2)</input></label>\n<hr><div>Internal\xa0</div>\n<label title="Relay1"><input name="a_act" type="checkbox" value="7">\xa0Relay1</input></label>\n</hr></hr></div>\n</div>\n<div class="alarmC">\n<span>Alarm must remain tripped for\r\n<input maxlength="3" name="a_del" size="3" style="width: 3em;" title="Delays taking any action until alarm is continuously tripped for this long (0 to 255 min)" type="text" value="1">\r\n(min) before notification</input></span>\n<div class="alarmBarH"></div>\n<span>Repeat every:\r\n<input maxlength="3" name="a_rep" size="3" style="width: 3em;" title="Repeats E-mails and traps until alarm is cleared (0 to 255 min)" type="text" value="0">\r\n(min)</input></span>\n</div><div class="alarmBarV" style="top: 5px; left: 470px;"></div>\n<input name="a_close" type="hidden" value="1"/></input></div>\n<div class="buttons"><input onclick="ITW.V.submitAlarms(this)" type="button" value="Save Changes">\n<input name="a_new" onclick="ITW.V.submitAlarms(this)" type="button" value="Add New Alarm"/></input></div>\n</input>]

,其中一个值包含&#34; a_dev&#34; 我=

========== i ===========
<input name="a_dev" type="hidden" value="0B0004A353FA9AC3">
<div class="divcolor2">
<input name="a_index" type="hidden" value="0">
<div class="alarmL">
<select name="a_meas" size="1" style="width:200px;">
<option value="-1">(REMOVE ALARM)</option><option selected="" value="0">Temperature</option>
<option value="1">Humidity</option>
<option value="2">Dewpoint</option>
<option value="3">Door Alarm</option>
<option value="4">-48 VDC Sensor</option>
<option value="5">AI3</option>
<option value="6">AI4</option>
</select>
<div>Trips if
<select name="a_trip" size="1" style="width:125px;">
<option value="0">Below</option>
<option selected="" value="1">Above</option>
</select></div>
<div>limit
<input maxlength="7" name="a_lim" style="width:100px;" type="text" value="120.00"/></div>
</div>
<div class="alarmS data_clear">CLEAR</div>
<div class="alarmBarV" style="top: 5px; left: 250px;"></div>
<div class="alarmR">
<div class="alarmSel">
<div>E-mail </div>
<label title="(Email 1)"><input name="a_act" type="checkbox" value="0"> (Email 1)</input></label>
<label title="(Email 2)"><input name="a_act" type="checkbox" value="1"> (Email 2)</input></label>
<label title="(Email 3)"><input name="a_act" type="checkbox" value="2"> (Email 3)</input></label>
<label title="(Email 4)"><input name="a_act" type="checkbox" value="3"> (Email 4)</input></label>
<label title="(Email 5)"><input name="a_act" type="checkbox" value="4"> (Email 5)</input></label>
<hr><div>SNMP Traps </div>
<label title="192.168.1.27"><input checked="" name="a_act" type="checkbox" value="5"> 192.168.1.27</input></label>
<label title="(Trap 2)"><input checked="" name="a_act" type="checkbox" value="6"> (Trap 2)</input></label>
<hr><div>Internal </div>
<label title="Relay1"><input name="a_act" type="checkbox" value="7"> Relay1</input></label>
</hr></hr></div>
</div>
<div class="alarmC">
<span>Alarm must remain tripped for
<input maxlength="3" name="a_del" size="3" style="width: 3em;" title="Delays taking any action until alarm is continuously tripped for this long (0 to 255 min)" type="text" value="0">
(min) before notification</input></span>
<div class="alarmBarH"></div>
<span>Repeat every:
<input maxlength="3" name="a_rep" size="3" style="width: 3em;" title="Repeats E-mails and traps until alarm is cleared (0 to 255 min)" type="text" value="1">
(min)</input></span>
</div><div class="alarmBarV" style="top: 5px; left: 470px;"></div>
<input name="a_close" type="hidden" value="1"/></input></div>
<div class="divcolor1">
<input name="a_index" type="hidden" value="1">
<div class="alarmL">
<select name="a_meas" size="1" style="width:200px;">
<option value="-1">(REMOVE ALARM)</option><option value="0">Temperature</option>
<option value="1">Humidity</option>
<option value="2">Dewpoint</option>
<option selected="" value="3">Door Alarm</option>
<option value="4">-48 VDC Sensor</option>
<option value="5">AI3</option>
<option value="6">AI4</option>
</select>
<div>Trips if
<select name="a_trip" size="1" style="width:125px;">
<option selected="" value="0">Below</option>
<option value="1">Above</option>
</select></div>
<div>limit
<input maxlength="7" name="a_lim" style="width:100px;" type="text" value="75.00"/></div>
</div>
<div class="alarmS data_clear">CLEAR</div>
<div class="alarmBarV" style="top: 5px; left: 250px;"></div>
<div class="alarmR">
<div class="alarmSel">
<div>E-mail </div>
<label title="(Email 1)"><input name="a_act" type="checkbox" value="0"> (Email 1)</input></label>
<label title="(Email 2)"><input name="a_act" type="checkbox" value="1"> (Email 2)</input></label>
<label title="(Email 3)"><input name="a_act" type="checkbox" value="2"> (Email 3)</input></label>
<label title="(Email 4)"><input name="a_act" type="checkbox" value="3"> (Email 4)</input></label>
<label title="(Email 5)"><input name="a_act" type="checkbox" value="4"> (Email 5)</input></label>
<hr><div>SNMP Traps </div>
<label title="192.168.1.27"><input checked="" name="a_act" type="checkbox" value="5"> 192.168.1.27</input></label>
<label title="(Trap 2)"><input checked="" name="a_act" type="checkbox" value="6"> (Trap 2)</input></label>
<hr><div>Internal </div>
<label title="Relay1"><input name="a_act" type="checkbox" value="7"> Relay1</input></label>
</hr></hr></div>
</div>
<div class="alarmC">
<span>Alarm must remain tripped for
<input maxlength="3" name="a_del" size="3" style="width: 3em;" title="Delays taking any action until alarm is continuously tripped for this long (0 to 255 min)" type="text" value="0">
(min) before notification</input></span>
<div class="alarmBarH"></div>
<span>Repeat every:
<input maxlength="3" name="a_rep" size="3" style="width: 3em;" title="Repeats E-mails and traps until alarm is cleared (0 to 255 min)" type="text" value="1">
(min)</input></span>
</div><div class="alarmBarV" style="top: 5px; left: 470px;"></div>
<input name="a_close" type="hidden" value="1"/></input></div>
<div class="divcolor2">
<input name="a_index" type="hidden" value="2">
<div class="alarmL">
<select name="a_meas" size="1" style="width:200px;">
<option value="-1">(REMOVE ALARM)</option><option selected="" value="0">Temperature</option>
<option value="1">Humidity</option>
<option value="2">Dewpoint</option>
<option value="3">Door Alarm</option>
<option value="4">-48 VDC Sensor</option>
<option value="5">AI3</option>
<option value="6">AI4</option>
</select>
<div>Trips if
<select name="a_trip" size="1" style="width:125px;">
<option selected="" value="0">Below</option>
<option value="1">Above</option>
</select></div>
<div>limit
<input maxlength="7" name="a_lim" style="width:100px;" type="text" value="4.00"/></div>
</div>
<div class="alarmS data_clear">CLEAR</div>
<div class="alarmBarV" style="top: 5px; left: 250px;"></div>
<div class="alarmR">
<div class="alarmSel">
<div>E-mail </div>
<label title="(Email 1)"><input name="a_act" type="checkbox" value="0"> (Email 1)</input></label>
<label title="(Email 2)"><input name="a_act" type="checkbox" value="1"> (Email 2)</input></label>
<label title="(Email 3)"><input name="a_act" type="checkbox" value="2"> (Email 3)</input></label>
<label title="(Email 4)"><input name="a_act" type="checkbox" value="3"> (Email 4)</input></label>
<label title="(Email 5)"><input name="a_act" type="checkbox" value="4"> (Email 5)</input></label>
<hr><div>SNMP Traps </div>
<label title="192.168.1.27"><input checked="" name="a_act" type="checkbox" value="5"> 192.168.1.27</input></label>
<label title="(Trap 2)"><input checked="" name="a_act" type="checkbox" value="6"> (Trap 2)</input></label>
<hr><div>Internal </div>
<label title="Relay1"><input name="a_act" type="checkbox" value="7"> Relay1</input></label>
</hr></hr></div>
</div>
<div class="alarmC">
<span>Alarm must remain tripped for
<input maxlength="3" name="a_del" size="3" style="width: 3em;" title="Delays taking any action until alarm is continuously tripped for this long (0 to 255 min)" type="text" value="1">
(min) before notification</input></span>
<div class="alarmBarH"></div>
<span>Repeat every:
<input maxlength="3" name="a_rep" size="3" style="width: 3em;" title="Repeats E-mails and traps until alarm is cleared (0 to 255 min)" type="text" value="0">
(min)</input></span>
</div><div class="alarmBarV" style="top: 5px; left: 470px;"></div>
<input name="a_close" type="hidden" value="1"/></input></div>
<div class="buttons"><input onclick="ITW.V.submitAlarms(this)" type="button" value="Save Changes">
<input name="a_new" onclick="ITW.V.submitAlarms(this)" type="button" value="Add New Alarm"/></input></div>
</input>
========== end i =========

当我尝试打印i.value时,我收到None

在理解这个问题时,我们将非常感激。

1 个答案:

答案 0 :(得分:1)

i.value会查找子<value>标记。试试i.attrs['value']