Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
import cgi
form = cgi.FieldStorage() # フォームからの値の取得
name = form.getvalue('name', '')
message = 'ようこそ、' + name + 'さん!'
print('Content-type: text/html; charset=UTF-8') # ヘッダ開始
print() # ヘッダ終了、これを省くとヘッダと認識してもらえない。
print('<html>')
print('<head>')
print('<title>テスト</title>')
print('</head>')
print('<body>')
print(message)
print('</body>')
print('</html>')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment