Working, posting with html-forms..

Robin Thomas robin.thomas at starmedia.net
Sun Feb 25 16:02:28 EST 2001


At 08:06 PM 2/25/01 +0000, Andrew Markebo wrote:
>I am working on reading, posting forms (web) and so on, and wonder if
>there are any work done to ease up this??
>
>Basically what I am looking for is something to throw a html-document
>into, and out comes some kind of data representation of the forms,
>that can be used when wanting to post the form back to the server..

Explore the DOM tools out there. Python's XML package includes DOM tools of 
various "weights". A DOM representation of an HTML document is what you 
would be used to dealing with in, say, JavaScript to both examine and 
modify forms and other nodes in the document. (Recent XML packages include 
DOM tools from 4Thought.com, called 4DOM.

After getting into the DOM stuff and reading the docs, you'll probably have 
some questions. :)


>p.s. BTW Any new revolutionarizing thoughts about the prompt for
>python?? I am starting to get borde by the >>>, why not turn them
>around <<<? :-)

 >>> import sys
 >>> sys.ps1
'>>> '
 >>> sys.ps1 = '<<< '
<<< print 'hey man'
hey man
<<< sys.ps1 = '>>> '
 >>>

"ps1" is a term from Unix shell. If you use Unix, do this in a shell:

myshell$ echo $PS1
<some weird string with special escapes, usually>

You'll also notice variables $PS2 and $PS4, which are "secondary prompts". 
Python doesn't feel the need to support extra prompts, so it just has 
sys.ps1 to represent the interactive prompt string. (The special character 
escapes you see in your Unix shell variables are not supported by Python's 
sys.ps1; sys.ps1 is always treated as a plain string.)

To annoy yourself to death on any OS platform, do

 >>> import sys
 >>> sys.ps1 = sys.ps1 + '\007' * 10

and see how long you can enjoy your custom prompt.


--
Robin Thomas
Engineering
StarMedia Network, Inc.
robin.thomas at starmedia.net





More information about the Python-list mailing list