Is Python powerful enough for this?

Roman Suzi rnd at onego.ru
Thu Aug 30 09:36:22 EDT 2001


On Thu, 30 Aug 2001, A wrote:

> Hi,
> I have some webpages that contain FORMS. Each form has input 
> fields and also some hidden fields. 
> How can I easily get urlencoded string from all these fields
> like
> Key1=Value1&Key2=Value2&Key3=Value3
> 
> For example:
> I have a following web page
> <html>
> 
> <head>
> </head>
> <body>
> <form method="POST" action="c.cgi">
>   <p><input type="text" name="T1" size="20"></p>
>   <p><input type="checkbox" name="C1" value="ON"></p>
>   <p><textarea rows="2" name="S1" cols="20"></textarea></p>
>   <p><input type="submit" value="Submit" name="B1"><input 
> type="reset" value="Reset" name="B2"></p>
> </form>
> </body>
> </html>
> 
> >From the above 
> I would like to receive 
> T1=&S1=&C1=&B1=Submit

I do not follow what are you trying to do?

Do you need to convert HTML input into corresponding urlencoded
output as if the form were filled empty?

For this you can make your htmllib.HTMLParser and make handlers for
form-specific tags. (In fact, sgmllib.SGMLParser is even easier to use for
this task).

And what if there are several forms on the page?
 
> Thank you for help.
> Ladislav

Sincerely yours, Roman A.Suzi
-- 
 - Petrozavodsk - Karelia - Russia - mailto:rnd at onego.ru -
 





More information about the Python-list mailing list