the html file we saw in the prior section is just that--an html filenot cgi script when referenced by browserthe remote web server simply sends back the file' text to produce new page in the browser to illustrate the nature of cgi scriptslet' recode the example as python cgi programas shown in example - example - pp \internet\web\cgi-bin\tutor py #!/usr/bin/python ""runs on the serverprints html to create new pageurl=""print('content-typetext/html\ 'print('cgi 'print(' first cgi script'print('hellocgi world!'this filetutor pymakes the same sort of page as example - if you point your browser at it--simply replace html with py in the urland add the cgi-bin subdirectory name to the path to yield its address to enter in your browser' address fieldbut this time it' very different kind of animal--it is an executable program that is run on the server in response to your access request it' also completely legal python programin which the page' html is printed dynamicallyinstead of being precoded in static file in factlittle is cgi-specific about this python programif run from the system command lineit simply prints html instead of generating browser pagec:\pp \internet\web\cgi-binpython tutor py content-typetext/html cgi first cgi script hellocgi worldwhen run by the http server program on web server machinehoweverthe standard output stream is tied to socket read by the browser on the client machine in this contextall the output is sent across the internet to your web browser as suchit must be formatted per the browser' expectations in particularwhen the script' output reaches your browserthe first printed line is interpreted as headerdescribing the text that follows there can be more than one header line in the printed responsebut there must always be blank line between the headers and the start of the html code (or other dataas we'll see later"cookiestate retention directives show up in the header area as wellprior to the blank line in this scriptthe first header line tells the browser that the rest of the transmission is html text (text/html)and the newline character (\nat the end of the first print call climbing the cgi learning curve