我想弄明白,爲了將數據發佈到正確的表單,什麼是關鍵,什麼是價值。在我看來,我認爲具有方法得到的html標籤的ID是關鍵。我在文本框中輸入的文本應該是值。使用python請求庫將數據發佈到搜索框
<form id="searchbox_form" class="searchbox_form form man" method="get" action="/submit_search/" autocomplete="off">
所以問題是,我將文本放入搜索框後,如何獲取網頁html? 謝謝各位,這是我的代碼
import requests
r = requests.post("http://www.trulia.com/homepage.php?",
data={'searchbox_form form man':'7420 Westlake Ter #1210 20817'})
with open("test.html", "w") as f:
f.write(r.text.encode("utf-8"))
對不起,我沒有檢查我的帖子在上週末,你的答案有用。謝謝! – MacSanhe 2014-11-10 21:19:48