python求助
能帮忙看看这是怎么回事吗{:5_99:}没有打印结果,也没有错误提示
import requests
import bs4
res=requests.get("http://movie.douban.com/top250")
print(res.text)
被豆瓣反爬了,加个请求头,模拟浏览器
import requests
import bs4
headers = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36'}
res=requests.get("http://movie.douban.com/top250",headers=headers)
print(res.text)
页:
[1]