我是非常新的蟒蛇和beautifulSoup太..我傾斜網站刮從瑞安mtichell書。 網站我正在刮是http://www.pythonscraping.com/pages/page3.html在python3.6美麗的查詢
from urllib.request import urlopen
from bs4 import BeautifulSoup
import re
html = urlopen("http://www.pythonscraping.com/pages/page3.html")
bs0bj = BeautifulSoup(html, "html.parser")
for i in bs0bj.find_all(id="gift1"):
print(i.get_text())
#for i in bs0bj.find_all("tr", {"class":"gift"}):
# print(i)
# for c in bs0bj.find_all("img", {"src":re.compile(\.\.\/img\/gifts/img.*\.jpg)}):
# print(c.image["src"])
我的問題是我想用形象的名字一樣... IMG /禮品沿廢只有1排禮品項目頭(「項目,descripion,成本,圖像)。 JPG但直到我不能做索姆有人可以幫我寫正確的代碼
,也請解釋代碼,這樣我可以把它理解太...沒有標籤
可能出現[如何使用BeautifulSoup從特定表中獲取所有行?](https://stackoverflow.com/questions/2010481/how-do-you-get-all-the-從特殊的桌子使用beautifulsoup) – user1211