我的代码如下:
<tr>
<td><b>Item 1</b></td>
<td>Name 1</td>
<td><i><b>Price 1</b></i></td>
</tr>
<tr>
<td><b>Item 2</b></td>
<td>Name 2</td>
<td><i><b>Price 2</b></i></td>
</tr>
<tr>
<td><b>Item 3</b></td>
<td>Name 3</td>
<td><i><b>Price 3</b></i></td>
</tr>
如何在BeautifulSoup的find_all语法中获得价格1,价格2,价格3的价值以及多个标签(<td><i><b>
)?感谢任何解决方案。
我试过了:
import os
import sys
from bs4 import BeautifulSoup
baca = open("asal.html", "r").read()
soup = BeautifulSoup(baca, "html.parser")
saring = soup.find_all(['td','b'])
for a in saring:
print a.text
&#13;