这里是一个get接口,拿到返回的数据类型是str


headers_admin = {'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
                  'X-Requested-With': 'XMLHttpRequest',
                 }
 r = requests.get('https://test.baidu.com/home-page/get-member-base-info', headers=headers_admin )
 print(type(r.text))

执行结果:<class ‘str’>
可以使用json.loads(r.text)将字符串转化成字典类型(导入import json

print(type(json.loads(r.text)))

执行结果:<class ‘dict’>