值得注意的一点是,list类型的数据可以用[2,3]的方式定义,如"b"

import json

jsonData = '{"a":1,"b":[2.0,2.1,2.2],"c":3,"d":4,"e":5}'

text = json.loads(jsonData)
print(type(text))
print(text)

print(type(text['b']))
print(text['b'])


y = json.dumps(text, sort_keys=True, indent=4, separators=(',', ': '))

print('y =')
print(y)

 

相关文章:

  • 2022-12-23
  • 2021-06-14
  • 2022-12-23
  • 2022-12-23
  • 2021-08-24
  • 2022-01-18
  • 2021-11-25
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-14
  • 2021-05-05
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案