如何在Python3中接收HTML表单数据?

如何在Python3中接收HTML表单数据?,python,html,python-3.x,Python,Html,Python 3.x,作为项目的一部分,我试图让python接收HTML发送的表单。获取变量后,我需要python在控制台中打印“True”或“False”。这是我当前表单的HTML代码 ... <form name = "input" action = "CheckLogin.py" method = "get"> <!-- This is the form. Here the user submits their username and password. The words before

作为项目的一部分,我试图让python接收HTML发送的表单。获取变量后,我需要python在控制台中打印“True”或“False”。这是我当前表单的HTML代码

...
<form name = "input" action = "CheckLogin.py" method = "get">

<!-- This is the form. Here the user submits their username and password. 
The words before the colon are the words that appear on the user's screen -->

    Username: <input type = "text" name = "htmlUser">
    <br>

    Password: <input type = "password" name = "htmlPassword">
    <input type = "submit" value = "Submit">
    <br>
</form>
...

我的问题是,如何让python从HTML Web表单中获取
用户名
密码
变量

只需在CheckLogin.py中获取这些值并将其传递给
login()

def login(username, password):
    import poplib
    try:
        server = poplib.POP3_SSL('pop.gmail.com', 995)#Weird bug here. When I use the exeter server, I am informed that the SSL number is incorrect. How do I fix?
        server.user(username)
        server.pass_(password)
        print ("True")
    except:
        print("False")

login (username, password)
import cgi
# ...
i = cgi.FieldStorage()
username = i["htmlUser"]
password = i["htmlPassword"]
login(username, password)