在使用 python 机械化时,我发现了获取 div 中的表单的主要问题。
这种形式是不可见的。
>>> s = [f.id for f in br.forms()]
>>> s
>>> []
如何处理存在于 div 中的表单?
例如考虑以下链接:
http ://www.world-exchanges.org/statistics/monthly-reports
在此链接中,表单位于 div 内。因此 mechanize 能够获取表单名称。
在这种情况下,我们将如何处理表格?
在使用 python 机械化时,我发现了获取 div 中的表单的主要问题。
这种形式是不可见的。
>>> s = [f.id for f in br.forms()]
>>> s
>>> []
如何处理存在于 div 中的表单?
例如考虑以下链接:
http ://www.world-exchanges.org/statistics/monthly-reports
在此链接中,表单位于 div 内。因此 mechanize 能够获取表单名称。
在这种情况下,我们将如何处理表格?
我无法重现这个问题,你能举一个具体的例子吗?div元素内的表单:
>>> br.open('http://realworldstyle.com/forms.html')
>>> print br.forms().next()
<GET http://realworldstyle.com/forms.html application/x-www-form-urlencoded
<TextControl(<None>=)>
<TextControl(<None>=)>
<TextControl(<None>=)>
<TextareaControl(<None>=Go ahead - write something...)>>