import json

l = [1,2,'abc',{'name':'bob','age':13}]
print(json.dumps(l))

d = dict(b=None,a=5,c='abc')
print(json.dumps(d, separators=[',',':']))  # 设置分隔符


# 按key值排序
print(json.dumps(d, sort_keys=True))


l2 = json.loads('{"b":"x","a":5,"c":"abc"}')
print(l2)




with open('','wb') as f:
    json.dump(l,f)

 

相关文章:

  • 2021-07-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-20
  • 2021-11-25
  • 2021-08-24
猜你喜欢
  • 2021-11-12
  • 2021-06-30
  • 2022-12-23
  • 2022-01-01
  • 2021-12-28
  • 2021-11-28
相关资源
相似解决方案