find_all使用問題
2020/03/20 01:49 下午
Python網路爬蟲討論版
許義翔
觀看數:3
回答數:2
收藏數:0
pycrawler
pycrawler-d12
Hi, 老師
不好意思有個比較基本的問題請教一下
在 Sample 中的這段 Code
for d in soup.find(class_="part_list_2").find_all('h3'):
print(d.find(class_="date").text, d.find_all('a')[-1].text)
其中 d.find_all('a')[-1].text,為什麼這邊要採用 -1 呢?而不是採用 0 來返回list呢?是否有特別意義?
謝謝!