当我执行python程序时,结果开始迅速出现,我无法全部阅读。它只是在我的屏幕上刷新。执行结束后,由于终端显示空间有限,我无法再看到第一个显示。
如何保存输出,以便我可以阅读所有内容?
您在这里有一些选择。
import pdb;pdb.set_trace() # this will take some learning so look up what pdb is online. actually, i prefer 'ipdb' instead.
)后,代码将在执行时在该特定点停止。python file.py > filename.txt
)中,然后再读取。奖金:在问自己之前,我的输出在哪里? https://askubuntu.com/questions/625224/how-to-redirect-stderr-to-a-file可能取决于平台。在Linux上,如果您不想将程序输出写入文件,也可以将其输出到您喜欢的寻呼机中。
python file.py | less