on the server machine to handle the inputs and generate reply to the browser on the client it uses the cgi module to parse the form' input and insert it into the html reply streamproperly escaped the cgi module gives us dictionary-like interface to form inputs sent by the browserand the html code that this script prints winds up rendering the next page on the client' browser in the cgi worldthe standard output stream is connected to the client through socket example - pp \preview\cgi-bin\cgi py #!/usr/bin/python import cgi form cgi fieldstorage(parse form data print('content-typetext/html\ 'hdr plus blank line print('reply page'html reply page if not 'userin formprint('who are you?'elseprint('hello % !cgi escape(form['user'value)and if all goes wellwe receive the reply page shown in figure - --essentiallyjust an echo of the data we entered in the input page the page in this figure is produced by the html printed by the python cgi script running on the server along the waythe user' name was transferred from client to server and back again--potentially across networks and miles this isn' much of websiteof coursebut the basic principles here applywhether you're just echoing inputs or doing full-blown -whatever figure - cgi py script reply page for input form if you have trouble getting this interaction to run on unix-like systemsyou may need to modify the path to your python in the #line at the top of the script file and make it executable with chmod commandbut this is dependent on your web server (againmore on the missing server piece in moment sneak preview