I am using BeautifulSoup for parsing html. So far I have the following code:
url = "http://routerpasswords.com"
data = {"findpass":"1", "router":"Belkin", "findpassword":"Find Password"}
post_data = urllib.urlencode(data)
req = urllib2.urlopen(url, post_data)
html_str = req.read()
parser = new BeautifulSoup(html_str)
table = parser.find("table")
Is there a way to get a list of all cels under column? Here is an example: If I had this table:
<table cellpadding="0" cellspacing="0" width="100%">
<thead>
<tr>
<th>Manufacturer</th>
<th>Model</th>
<th width="80">Protocol</th>
<th width="80">Username</th>
<th width="80">Password</th>
</tr>
</thead>
<tbody>
<tr>
<td><b>BELKIN</b></td>
<td>F5D6130</td>
<td>SNMP</td>
<td>(none)</td>
<td>MiniAP</td>
</tr>
<tr>
<td><b>BELKIN</b></td>
<td>F5D7150<i> Rev. FB</i></td>
<td>MULTI</td>
<td>n/a</td>
<td>admin</td>
</tr>
<tr>
<td><b>BELKIN</b></td>
<td>F5D8233-4</td>
<td>HTTP</td>
<td>(blank)</td>
<td>(blank)</td>
</tr>
<tr>
<td><b>BELKIN</b></td>
<td>F5D7231</td>
<td>HTTP</td>
<td>admin</td>
<td>(blank)</td>
</tr>
</tbody>
</table>
How can I get a list of all the items in a column Username? I would prefer them to be strings too.
source
share