【发布时间】:2017-12-21 04:32:23
【问题描述】:
import urllib2
from bs4 import BeautifulSoup
url = 'https://www.wsj.com/news/world'
page = urllib2.urlopen(url)
soup = BeautifulSoup(page, 'html.parser')
l = soup.find_all('div', {'class': 'module module_ls ls ni noImage'})
a = soup.find_all('a', {'class': 'subPrev headline'})
print(l)
print(a)
这将返回空列表。但正如您在图片中看到的那样,这些类存在 div... 为什么?
【问题讨论】:
标签: python beautifulsoup urllib