有一个网页类似于:www.example.com/form.php你知道吗
我想使用Python从页面上的HTML表单中获取一个值。例如,如果窗体有,我可以得到返回的值“test”
我已经在google上搜索了很多,但大部分都和发布表单数据有关,或者建议使用Django或cgi-bin。我不能直接访问服务器,所以我不能这样做。你知道吗
我以为图书馆的要求可以做到这一点,但我在文档中看不到。你知道吗
HTML格式:
<html>
<body>
<form method="" action="formpost.php" name="form1" id="form1">
<input type="text" name"field1" value="this is field1">
<input type="hidden" name="key" value="secret key field">
</form>
</body>
作为一个例子,我想在Python中使用如下内容:
import special_library
html = special_library.get("http://www.example.com/form.php")
print html.get_field("wanted")
有没有人对实现这一目标有什么建议?或者任何我可能没有想到或不知道的图书馆?你知道吗
您可以使用
requests
库和lxml
试试这个:
您可以检查以下资源:
^{}
^{}
相关问题 更多 >
编程相关推荐