かんたん作成【HTML CSS JavaScript PHP CGI Perl Ruby Python .htaccess】

環境変数一覧表(os.environ.items)

#! /usr/bin/python
# coding: Shift_JIS

import os
import re

print "Content-type: text/html"
print """
    <html>
    <head>
    <title>環境変数一覧表</title>
    </head>
    <body>
    <table align="center" border="1" bordercolor="00cc66" cellspacing="0">
"""

for key, value in os.environ.items():
    value = re.sub("\w", "*", value)            #サンプルのため非表示
    print "<tr><td>%s</td><td>%s</td></tr>" % (key, value)

print """
    </table>
    </body>
    </html>
"""
かんたん作成【HTML CSS JavaScript PHP CGI Perl Ruby Python .htaccess】