soup.select("table tr td:nth-of-type(1)") not return list
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Beautiful Soup |
New
|
Undecided
|
Unassigned |
Bug Description
here is test code
-------
from bs4 import BeautifulSoup
text='''
<html><head><style>
table tr td:nth-of-type(1){
background:red;
}
</style>
<div id="r_2368837" class="cell">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td > php </td>
<td > 100 </td>
<td > first </td>
</tr>
</table>
</div>
<div id="r_2368838" class="cell">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td > python </td>
<td > 200 </td>
<td > second </td>
</tr>
<tr> <td> tatal aaaa </td></tr>
</table>
</div>
</body></html>
'''
soup =BeautifulSoup(
out=soup.
for tr in out:
print(
print(tr)
-------
expect list [ "<td > php </td>",
" <td> total xxxx </td>",
"<td > python </td>",
" <td> tatal aaaa </td>"]
but return only first element " <td > php </td> "
save the text as test.html ,you can see the correct result
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
I'm pretty sure this is the same as bug #150760.