使用此代码:
def getTD_byText1(text):
soup = BeautifulSoup(open(r"D:\testData\test.htm"))
div_=soup.find('div',attrs={'id':'CONTROL_VideoAdapter_MultiSelect'})
for input in div_.findAll('input',attrs={'name':'CID_CONTROL_VideoAdapter_MultiSelect'}):
#print input
td=input.find_parent()
td_text=td.get_text().strip()
#print td
if td_text.find(text)>0:
print td.find_previous_sibling()
drp=td.find_previous_sibling()
drp=getTD_byText1('A3WJ')
我得到了元素:
<td width="1%">
<select class="interactiveSelectAction" id="interactiveSelectControl" name="CID_CONTROL_VideoAdapter_MultiSelect_QTY" size="1">
<option selected="selected" value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
</td>
如何更改 中的选项值td
,当我更改值时,新值将显示在 html 上?