Python爬知乎热榜出现了Process finished with exit code 0
我找过了试过了
1.更改python的解释器
2.重新部署过文件
但是依旧是Process finished with exit code 0
想知道是不是我的代码错了
import requests
from bs4 import BeautifulSoup
import re
headers={
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.40 Safari/537.36'
}
url='https://www.zhihu.com/hot'
html=requests.get(url,headers=headers)
soup=BeautifulSoup(html.text,'lxml')
divs=soup.select('.Topstory-content ')
for div in divs:
title = div.select('.HotList-list a .HotItem-title')[0].text
print('标题:',title)
soup=BeautifulSoup(html.text,'lxml')
run=soup.select('.Topstory-content .HotList-list p')
for r in run:
print(r.text)