0
我有一個問題從本網站獲取所有數據... 我無法生成所有數據的代碼段是「pn」 我希望這段代碼能夠生成這些代碼來自該網站的數字。python beautifulSoup找到所有
58312-GA4 58312-RG4 58312-RR $
我試圖從切換標籤和類與發現,的findAll回去,第四次和find_all不管一些事情是我嘗試我只得到一個結果。 任何幫助將是巨大的 - 感謝 下面是代碼:
theurl="http://www.colehersee.com/home/grid/cat/14/?"
thepage = urllib.request.urlopen(theurl)
soup = BeautifulSoup(thepage,"html.parser")
for pn in soup.find('table',{"class":"mod_products_grid_listing"}).find_all('span',{"class":"product_code"}):
pn2 = pn.text
for main in soup.find_all('nav',{"id":"breadcrumb"}):
main1 = main.text
print(pn2)
print (main1)
謝謝 - 非常完美!!!! – PatrickP76
我只是試圖增加1到10的類別。代碼正在運行,但是是空白的。如果我不運行代碼而運行代碼,那麼效果很好。當我將這些添加到代碼中時,我得到了一個響應,但它全部是空白的,就好像它不識別頁面一樣。這裏是: i = 0 while i <10: theurl =「http://www.colehersee.com/home/grid/cat/」+ str(i)+「/?」 – PatrickP76
對不起,我沒有解釋發送 - 我只允許每90分鐘問一個問題,所以我想也許我可以在這裏問... – PatrickP76