How can i find the form name without "nr=0"

scripteaze scripteaze at gmail.com
Wed Nov 7 23:17:14 EST 2007


On Nov 7, 1:35 pm, j... at pobox.com (John J. Lee) wrote:
> alex23 <wuwe... at gmail.com> writes:
> > On Nov 6, 8:56 am, scripteaze <scripte... at gmail.com> wrote:
> >> Is it possible then to have a form with no name and if so, how can i
> >> access this form
>
> > Hey scripteaze,
>
> > I'm not sure about mechanize, but you might have more success using
> > another one of the author's modules, ClientForm:http://wwwsearch.sourceforge.net/ClientForm/
>
> > from urllib2 import urlopen
> > from ClientForm import ParseResponse
>
> > response = urlopen("http://wwwsearch.sourceforge.net/ClientForm/
> > example.html")
> > forms = ParseResponse(response, backwards_compat=False)
> > form = forms[0]
>
> > As it returns a list of forms, you don't need to have a name to access
> > it.
>
> mechanize forms are ClientForm forms.
>
> Quoting from mechanize.Browser.select_form().__doc__:
>
> """
>         Another way to select a form is to assign to the .form attribute.  The
>         form assigned should be one of the objects returned by the .forms()
>         method.
> """
>
> forms = list(br.forms())
> br.form = pick_a_form(forms, br.global_form())
>
> The "global form" (couldn't think of a better term) consists of all
> form controls not contained in any FORM element.
>
> John- Hide quoted text -
>
> - Show quoted text -

Thank you guys for replying, im sure that one of these methods will
suffice, after this project, im definatly going to do more in lui of
web apps for learning..Thanks again




More information about the Python-list mailing list