接口返回数据:

print sql[0][10]

{"recv_name":"rdgztest_63126","send_name":"rdgztest_63126","recv_avatar":"https://wx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTJ2bWib0TF1ppuFHlbN2W1tcoy68o0MJGkOrSke6uBibHTnSI3a8DsEWW6icJ5Vu0OLN8wPWEfHRDe1w/132","send_avatar":"https://wx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTJ2bWib0TF1ppuFHlbN2W1tcoy68o0MJGkOrSke6uBibHTnSI3a8DsEWW6icJ5Vu0OLN8wPWEfHRDe1w/132","blessing_msg":"118默认祝福语"}

   a = sql[0][10]

print type(a)
#输出为“Unicode”类型,转换为“str”类型
str1 = a.encode('utf-8')
print type(str1)
#“str”转换为“dict”
dict = json.loads(str1)
print type(dict)
#“dict”取值
print dict["recv_name"]

相关文章:

  • 2022-02-20
  • 2021-05-05
  • 2021-10-14
  • 2021-10-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-30
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-03
  • 2022-12-23
  • 2021-12-15
  • 2022-02-12
  • 2022-12-23
相关资源
相似解决方案