【问题标题】:how to fetch form inside div using mechanize如何使用机械化在 div 中获取表单
【发布时间】:2012-05-08 10:21:38
【问题描述】:

在使用 python 进行机械化时,我发现了一个主要问题是获取 div 中的表单。

这样的表格是不可见的。

>>> s = [f.id for f in br.forms()]
>>> s
>>> []

如何处理 div 中存在的表单?

例如考虑以下链接:
http://www.world-exchanges.org/statistics/monthly-reports

在此链接中,表单位于 div 中。因此 mechanize 能够获取表单名称。
在这种情况下,我们将如何处理表单?

【问题讨论】:

    标签: python html mechanize


    【解决方案1】:

    我无法重现这个问题,你能举一个具体的例子吗? div 元素内的 form

    >>> 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...)>>
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-16
    • 1970-01-01
    • 2012-04-19
    • 1970-01-01
    相关资源
    最近更新 更多