#coding:utf-8
json.dumps(a, indent=5, ensure_ascii=False)

ensure_ascii表示的意思是是否要转为ASCII码,如果打开(默认打开True),那么转为json后中文会变成ASCII编码,如果关闭后中文还是中文,不会变为ASCII编码。

indent表示间隔的长度,如下图所示:

json.dump里面参数的使用及应用,json.dumps(a, indent=5, ensure_ascii=False)

相关文章:

  • 2022-12-23
  • 2021-12-14
  • 2022-03-15
  • 2022-12-23
  • 2022-12-23
  • 2021-06-17
猜你喜欢
  • 2021-08-20
  • 2022-12-23
  • 2022-01-12
  • 2022-12-23
相关资源
相似解决方案