我正在尝试从以下页面提取tr数据:
http://www.datasheetcatalog.com/catalog/p1342320.shtml
我正在使用请求和
BeautifulSoup
. 但是,我没有得到所有行(第二个表中只有12行,而不是22行)。有人对此有解释吗(前提是在打印response.content时有行)?
下面是我使用的代码:
from bs4 import BeautifulSoup
import requests
session = requests.Session()
url = 'http://www.datasheetcatalog.com/catalog/p1342320.shtml'
response = session.get(url)
soup = BeautifulSoup(response.content,"lxml")
trs= soup.findAll('table')[8].findAll('tr')
print (len(trs))