Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

Vinllen Chen


To be a better coder

Python json格式化输出

  输出json格式时默认没有换行,不便于查看json结果,可以采用这样进行输出:json.dumps(ret, sort_keys = True, indent = 4, separators=(',', ': ')),进行缩进和换行,方便查看结果。

参考

http://stackoverflow.com/questions/16318543/cant-pretty-print-json-from-python


About the author

vinllen chen

Beijing, China

格物致知


Discussions

comments powered by Disqus