我有这个代码:
br.open(url)
br.select_form(nr=0)
br.form['mydropdown'] = 1
r = br.submit()
print r1.read()
我尝试提交的表单的 HTML 是:
<select name="mydropdown">
<option value="1">Cake</option>
<option value="2">Apple</option>
<option value="3">Muffin</option>
为什么我收到此错误:
Traceback (most recent call last):
File "***", line 9, in <module>
br.form['dropdown'] = 1
File "***", line 2782, in __setitem__
control.value = value
File "***", line 1977, in __setattr__
self._set_value(value)
File "***", line 1993, in _set_value
elif len(value) > 1:
TypeError: object of type 'int' has no len()