将response对象,转为列表字典

it2025-05-16  3

将response对象,转为列表/字典 import requests from bs4 import BeautifulSoup

res_music = requests.get( ‘https://c.y.qq.com/soso/fcgi-bin/client_search_cp?ct=24&qqmusic_ver=1298&new_json=1&remoteplace=txt.yqq.song&searchid=71086016682587379&t=0&aggr=1&cr=1&catZhida=1&lossless=0&flag_qc=0&p=1&n=10&w=%E4%BA%94%E6%9C%88%E5%A4%A9&g_tk_new_20200303=5381&g_tk=5381&loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8&notice=0&platform=yqq.json&needNewCode=0’ )

#请求html,得到response print(res_music.text) #打印res_music的内容

json_music = res_music.json() #使用json()方法,将response对象,转为列表/字典

print(type(json_music))

最新回复(0)