response.json()和json.loads(response.content)都可以将统一编码转化为python类型

import requests
import json
url = "https://m.douban.com/rexxar/api/v2/subject_collection/tv_american/items?os=android&for_mobile=1&start={0}&count=18&loc_id=108288&_=1571618800490"
headers = {
    "User-Agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Mobile Safari/537.36",
    "Referer": "https://m.douban.com/tv/american"
}
def getData():
    num=0
    total=0
    temp_url=url.format(num)
    response=requests.get(temp_url,headers=headers)
    s=json.loads(response.content)#或者s=response.json()
    print(s)
 getData()

你可能感兴趣的:(python,json)