pycharm爬虫运行无结果哪里出了问题


url = "https://news.163.com/world/"
headers = {"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 Edg/110.0.1587.57"}
response = requests.get(url, headers=headers)
html = response.text
soup = BeautifulSoup(html, "lxml")
content_all = soup.find_all(class_="news_title")
for content in content_all:
    print(content.string)

pycharm运行结果显示Process finished with exit code 0
求问哪里出了问题呀?

你打开网页都没有数据的,怎么爬

请先采纳!
print(content_all)看看
匹配错误!

img

不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^