是否可以更改 IPython 使用的漂亮打印机?
我想换掉默认的漂亮打印机pprint++
,我更喜欢嵌套结构之类的东西:
In [42]: {"foo": [{"bar": 42}, {"bar": 16}] * 3, "bar": [1,2,3,4,5]}
Out[42]:
{'bar': [1, 2, 3, 4, 5],
'foo': [{'bar': 42},
{'bar': 16},
{'bar': 42},
{'bar': 16},
{'bar': 42},
{'bar': 16}]}
In [43]: pprintpp.pprint({"foo": [{"bar": 42}, {"bar": 16}] * 5, "bar": [1,2,3,4,5]})
{
'bar': [1, 2, 3, 4, 5],
'foo': [
{'bar': 42},
{'bar': 16},
{'bar': 42},
{'bar': 16},
{'bar': 42},
{'bar': 16},
{'bar': 42},
{'bar': 16},
{'bar': 42},
{'bar': 16},
],
}