Bilaga "explore.py"

Ladda ner

   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 """

Bifogade filer

För att referera till bilagor på en sida, använd attachment:filename, som visas nedan i listan av filer. Använd INTE [get] länkens URL, eftersom den inte är permanent och kan ändras.
  • [hämta | visa] (2011-08-02 21:19:28, 0.7 KB) [[attachment:explore.py]]
 All files | Selected Files: delete move to page copy to page

Du får inte bifoga en fil till den här sidan.