2015-06-20 119 views
0

试图建立我自己的网络邮件客户端。 我得到它看起来像这样HTML - Python如何访问表单元素?

<form name="input" action="test2.py" methog="get" class="form"> 
    <input type="text" name="Username" placeholder="Username"> 
    <input type="password" name="Pass" placeholder="Password"> 
    <button type="submit" id="login-button">Login</button> 
</form> 

想通过GET方法& &通行证获得点击输入用户名上的按钮,以填补这串代码在Python Web部件的模板。

user = ???(Username) 
pass = ???(Pass) 

并打印到一个新的空白html文件thoses var的值。

python的新东西,所以我尝试的一切似乎失败。

+0

https://docs.python.org/2/library/cgi.html#using-the-cgi-module – Rishav

+0

excatly我做了什么...但似乎不工作点击。我需要一些Js吗? – Ragnar

+0

我不这么认为..你能粘贴你当前的Python代码吗? – Rishav

回答

0

您应该使用method="post",它不会与GET方法(但它拼写错误,你写了“methog”)。