在 Python Shell 和 BPython 中,我都试图让我的输出自然地分成多行,就像它在节点解释器中所做的那样。
这是我的意思的一个例子:
# This is what is currently happening
# (I'm truncating output, but the response is actually a lot longer than this):
>>> response.dict
{'status': '200', 'accept-ranges': 'bytes', 'cache-control': 'max-age=604800'}
# Here's what I'd like to happen:
>>> response.dict
{'status': '200',
'accept-ranges': 'bytes',
'cache-control': 'max-age=604800'}
这将使阅读内容变得更容易。有谁知道是否可以在 BPython 或普通 shell 中配置它?(或者老实说,任何解释器——我都会切换到任何让我这样做的地方。)
非常感谢!
编辑:感谢大家的回答!我以前遇到过 Pretty Print 并考虑过使用它。我还考虑过只使用 for 循环在自己的行上打印所有内容。这些想法不错,但我希望我可以让解释器自动完成。