import requests
import jsonpath
url='https://movie.douban.com/top250'
html=requests.get(url).text
print(html)
# f=open(html)
# html1=eval(html) #错误示范
html_json=html.jsons()['title']
# f=open(html_json)
title_json=jsonpath.jsonpath(html_json,'$..title')
print(title_json)
html_json=html.jsons()['title']
AttributeError: 'str' object has no attribute 'jsons'
小白求助,看了很多篇文章,都说是load指定返回的是文件对象,loads指定返回的是json字符串,但是明明返回的是str格式,导致无法读取,麻烦大佬给一下正确的代码。球球了。