0
私はtdクラス 'column-1'でテキストを取得しようとしていますが、属性テキストがないので問題があります。私はライン2を取ると、私は結果を得る上で、単に「部」を印刷しますが、それだけではなく、列-1のすべてのTDを与えている場合python beautifulsoup findall内find
import urllib
import urllib.request
from bs4 import BeautifulSoup
theurl="http://vermontamerican.com/products/standard-drill-bit-extensions/"
thepage = urllib.request.urlopen(theurl)
soup = BeautifulSoup(thepage,"html.parser")
for part in soup.find_all('td'),{"class":"column-1"}:
part1 = part.text
print(part1)
:ここではコードです。 私もこれを試しましたが、私は新しいので、これは間違っていると確信しています。
import urllib
import urllib.request
from bs4 import BeautifulSoup
theurl="http://vermontamerican.com/products/standard-drill-bit-extensions/"
thepage = urllib.request.urlopen(theurl)
soup = BeautifulSoup(thepage,"html.parser")
for part in soup.find('tbody'),{"class":"row-hover"}:
for part1 in part.find_all('a'):
print(part1)
ああ、私は馬鹿です!ありがとうございました!! – PatrickP76