230:クエリ文字列を取り出す
os モジュールの environ から環境変数にアクセスできます。あとは QUERY_STRING 環境変数を読み出すだけです。
#!/usr/local/bin/python
# coding: utf-8
import os
import cgi
html = u"""
<html>
<head>
<meta http-equive="content-type" contetnt="text/html;charset=utf-8" />
</head>
<body>
<form method="GET" action="/cgi-bin/b.py">
テキスト入力欄
<input type="text" name="item" />
<input type="submit" />
</form>
%(input)s
</body>
</html>"""
contents = {}
qs = os.environ.get('QUERY_STRING', u'')
contents['input'] = u'<p>QUERY_STRING: %s</p>' % cgi.escape(qs)
print u"Content-type: text/html;charset=utf-8\n".encode('utf-8')
print (html % contents).encode('utf-8')