Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> Python

Cách gửi kết quả Python CGI script đến trình duyệt?

# Lấy dữ liệu từ form HTML
first_name = form.getvalue('first_name')
last_name = form.getvalue('last_name')
# Gửi dữ liệu đến Browser
print("Content-type:text/html")
print()
print("<html>")
print("<head>")
print("<title>Hello - Second CGI Program</title>")
print("</head>")
print("<body>")
print(" Hello %s %s " % (first_name, last_name))
print("</body>")
print("</html>")