ApacheOnLinuxFtp

Attachment 'explore.py'

Download

   1 #!/usr/bin/python
   2 
   3 import os.path
   4 import os
   5 import sys
   6 
   7 try:
   8     __file__
   9 except NameError:
  10     __file__ = '?'
  11 
  12 print """Content-type: text/html
  13 
  14 <html>
  15 <head>
  16  <title>Python Exploration</title>
  17 </head>
  18 <body>
  19  <table border=1>
  20  <tr><th colspan=2>1. System Information</th></tr>
  21  <tr><td>Python</td><td>%s</td></tr>
  22  <tr><td>Platform</td><td>%s</td></tr>
  23  <tr><td>Absolute path of this script</td><td>%s</td></tr>
  24  <tr><td>Filename</td><td>%s</td></tr>
  25 """ % (sys.version,
  26        sys.platform,
  27        os.path.abspath('.'),
  28        __file__)
  29 print "<th colspan=2>2. Environment Variables</th>"
  30 for variable in os.environ:
  31     print "<tr><td>%s</td><td>%s</td></tr>\n" % (variable, os.environ[variable])
  32 print """
  33 </table>
  34 </body>
  35 </html>
  36 """

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2009-05-30 23:49:58, 0.7 KB) [[attachment:explore.py]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.

All text is available under the terms of the GNU Free Documentation License.