2024-06-16 11:15:28 发布
网友
当我在pdb中并且有一个大字符串时,有时我希望用换行符作为实际换行符打印出来,而不是在终端中看到它们。在
(Pdb) p large_string "very large string with newline\nanother line in the large string\n\netc\n"
我宁愿看看
有什么提示吗?在
您可以在任何Python命令前面加上“!”,因此这也适用于Python 2.x:
!print large_string
如果使用Python 2.x,则可以导入print函数:
from __future__ import print_function (Pdb) print(large_string) very large string with newline another line in the large string
只需调用正常打印函数:
(Pdb) print(large_string) very large string with newline another line in the large string etc (Pdb)
您可以在任何Python命令前面加上“!”,因此这也适用于Python 2.x:
如果使用Python 2.x,则可以导入print函数:
只需调用正常打印函数:
相关问题 更多 >
编程相关推荐