[Python编程(第4版)].(Programming.Python.4th.Edition).Mark.Lutz.文字版

(yzsuai) #1

This demo shows how to display a "hello world" message in various
programming languages' syntax. To keep this simple, only the output command
is shown (it takes more code to make a complete program in some of these
languages), and only text-based solutions are given (no GUI or HTML
construction logic is included). This page is a simple HTML file; the one
you see after pressing the button below is generated by a Python CGI script
which runs on the server. Pointers:


  • To see this page's HTML, use the 'View Source' command in your browser.
  • To view the Python CGI script on the server,
    click here or
    here.
  • To see an alternative version that generates this page dynamically,
    click here.





Select a programming language:





For the moment, let’s ignore some of the hyperlinks near the middle of this file; they
introduce bigger concepts like file transfers and maintainability that we will explore in
the next two sections. When visited with a browser, this HTML file is downloaded to
the client and is rendered into the new browser page shown in Figure 15-21.


That widget above the Submit button is a pull-down selection list that lets you choose
one of the


1184 | Chapter 15: Server-Side Scripting

Free download pdf