Python 爬虫 返回json内容

如果返回的是json内容  可以用requests模块自带的  response.json() 直接转成Python 字典

或者引入json模块  用json.loads(response.content)

将返回内容 保存到文件里  

with open('xxxx.html','wb') as f:

  f.write(response.content)

返回的内容转码  response.decode('utf-8')

猜你喜欢

转载自www.cnblogs.com/python666666/p/9998691.html