- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
JSON 可以使用 indent=None
(默认)作为单行(人眼无法读取)或使用 ident=N
在每个逗号后换行.
我希望看到的是更紧凑但仍然漂亮的输出,类似于 Common Lisp pretty-print 所做的。例如,而不是
{
"cleanup":{
"cpu":6936.780000000001,
"wall":7822.319401979446
},
"finished":"2017-08-14 18:36:23",
"init":{
"cpu":1365.73,
"wall":1380.7802910804749
},
"job":"timings",
"run":{
"cpu":953.6700000000001,
"wall":8350.496850013733
},
"started":"2017-08-14 13:28:06"
}
我想看看
{
"cleanup":{"cpu":6936.780000000001,"wall":7822.319401979446},
"finished":"2017-08-14 18:36:23",
"init":{"cpu":1365.73,"wall":1380.7802910804749},
"job":"timings",
"run":{"cpu":953.6700000000001,"wall":8350.496850013733},
"started":"2017-08-14 13:28:06"
}
类似于pprint
产生。
最佳答案
目前这是不可能的,但是当RFE: more compact pretty printing已实现,将使用 python-rapidjson 回答此问题.
关于python - python 中紧凑但漂亮的 JSON 输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45681702/
问题:用任何语言编写一个程序,给定一个字符串,生成一个与输入字符串的任何字谜匹配的正则表达式。对于所有大于某个长度 N 的正则表达式,正则表达式必须短于列出所有可能的字谜的“蛮力”解决方案,其中列出了
我正在尝试使用 html 和 css 生成一个简单的甘特图,我需要弄清楚如何使它紧凑,这意味着如果有可用的空白,该条应尝试适合前一行,同时保持相同的 x 距离。 上下文: X 轴是以月为单位的时间轴
我收到以下错误 (1/1) ErrorException compact(): Undefined variable: operator 这是我的代码行 $postsCat = Post::w
我正在使用 java 读取紧凑/截断的 PDF417 条形码,并且我有标准 PDF417 条形码的开始和结束模式的矩阵: Start Pattern = 81111113 (ending wit
我正在使用的当前 ListView 在文本上方和下方有额外的空间。我如何使它成为一个真正紧凑的? http://jsfiddle.net/qW6sP/8/
是否有办法“压缩”SQL 查询的结果? 结果如下: +----+-----------+----------+-----------+-------------+--------+ | ID | Fi
我目前在我的 Java 项目中使用 JSON(通过 gzip 压缩),其中我需要在磁盘上存储大量对象(数亿)。我每行有一个 JSON 对象,并且不允许在 JSON 对象中换行。这样我就可以逐行从磁盘流
R具有qr()函数,该函数使用LINPACK或LAPACK执行QR分解(以我的经验,后者快5%)。返回的主要对象是一个矩阵“ qr”,该矩阵包含在上三角矩阵R中(即R=qr[upper.tri(qr)
我希望开始 SQL 开发,因此决定用 Java 和 C# 实现一个使用基于 SQL 的数据库的应用程序,特别是它将是一个桌面应用程序,用于存储某些类型的数据通过数据库访问用户机器。 阅读此处发布的答案
我目前正在尝试解决一个奇怪的问题。我找不到太多相关信息。 简而言之: 当反序列化一个 xml 序列化对象时,我得到了一个正确对象类型的实例,但我只得到了对象内部的默认值。 长话短说: 序列化和反序列化
假设我需要一个包含许多重复元素的数组,如下所示: [3,3,3,3,3,8,8,8,8,5,5,5,5,5,5](所以这是五个 3,四个 8,和六个 5) 在 python 中,你可以像这样非常优雅地
这个问题在这里已经有了答案: Reverse the ordering of words in a string (48 个回答) 关闭 7 年前。 所以我正在尝试针对提示提出一个好的 C++ 解决
我是一名优秀的程序员,十分优秀!