我正在尝试从以下站点获取信息:http : //www.ebi.ac.uk/intact/,然后搜索 Q9SUE8。使用 urllib 我得到页面的 html:
import urllib2
import urllib
url = 'http://www.ebi.ac.uk/intact/'
values = {'queryTxt':'Q9SUE8'}
data = urllib.urlencode(values)
req = urllib2.Request(url, data)
response = urllib2.urlopen(req)
the_page = response.read()
print the_page
从浏览器搜索 Q9SUE8 时,结果如下表:
# Molecule 'A' Links 'A' Molecule 'B' Links 'B' some more columns
--------------------------------------------------------------------------------
1 T13J8.10 Q9SUE8 GRF7 Q96300
EBI-4459886
我想提取值 Q96300。我可以在 html 中找到列标题:
<tr>
<td>
<input id="mainPanels:columnSelection:3" type="checkbox" name="mainPanels:columnSelection" checked="checked" value="moleculeB.links" />
<label for="mainPanels:columnSelection:3"> Links 'B'</label>
</td>
</tr>
我对 html 不熟悉,但我猜 Q96300 来自 value="moleculeB.links"。我怎样才能得到那个值?