summaryrefslogtreecommitdiffstats
path: root/Doc/library/cgi.rst
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-09-04 07:15:32 (GMT)
committerGeorg Brandl <georg@python.org>2007-09-04 07:15:32 (GMT)
commit6911e3ce3f72af759908b869b73391ea00d328e2 (patch)
tree5d4ff6070cb3f0f46f0a31ee4805b41053a06b48 /Doc/library/cgi.rst
parentc9879246a2dd33a217960496fdf4606cb117c6a6 (diff)
downloadcpython-6911e3ce3f72af759908b869b73391ea00d328e2.zip
cpython-6911e3ce3f72af759908b869b73391ea00d328e2.tar.gz
cpython-6911e3ce3f72af759908b869b73391ea00d328e2.tar.bz2
Convert all print statements in the docs.
Diffstat (limited to 'Doc/library/cgi.rst')
-rw-r--r--Doc/library/cgi.rst22
1 files changed, 11 insertions, 11 deletions
diff --git a/Doc/library/cgi.rst b/Doc/library/cgi.rst
index d2b88aa..84262f5 100644
--- a/Doc/library/cgi.rst
+++ b/Doc/library/cgi.rst
@@ -46,16 +46,16 @@ line. The first section contains a number of headers, telling the client what
kind of data is following. Python code to generate a minimal header section
looks like this::
- print "Content-Type: text/html" # HTML is following
- print # blank line, end of headers
+ print("Content-Type: text/html") # HTML is following
+ print() # blank line, end of headers
The second section is usually HTML, which allows the client software to display
nicely formatted text with header, in-line images, etc. Here's Python code that
prints a simple piece of HTML::
- print "<TITLE>CGI script output</TITLE>"
- print "<H1>This is my first CGI script</H1>"
- print "Hello, world!"
+ print("<TITLE>CGI script output</TITLE>")
+ print("<H1>This is my first CGI script</H1>")
+ print("Hello, world!")
.. _using-the-cgi-module:
@@ -104,11 +104,11 @@ string::
form = cgi.FieldStorage()
if not ("name" in form and "addr" in form):
- print "<H1>Error</H1>"
- print "Please fill in the name and addr fields."
+ print("<H1>Error</H1>")
+ print("Please fill in the name and addr fields.")
return
- print "<p>name:", form["name"].value
- print "<p>addr:", form["addr"].value
+ print("<p>name:", form["name"].value)
+ print("<p>addr:", form["addr"].value)
...further form processing here...
Here the fields, accessed through ``form[key]``, are themselves instances of
@@ -505,8 +505,8 @@ you can use an even more robust approach (which only uses built-in modules)::
import sys
sys.stderr = sys.stdout
- print "Content-Type: text/plain"
- print
+ print("Content-Type: text/plain")
+ print()
...your code here...
This relies on the Python interpreter to print the traceback. The content type