当我在 pdb 中并且有一个大字符串时,有时我想用换行符作为实际换行符将其打印出来,而不是在终端中将它们视为 \n 。
(Pdb) p large_string
"very large string with newline\nanother line in the large string\n\netc\n"
Run Code Online (Sandbox Code Playgroud)
我宁愿看到
(Pdb) printwithnewline large_string
"very large string with newline
another line in the large string
etc
"
Run Code Online (Sandbox Code Playgroud)
有小费吗?
只需调用普通的打印函数:
(Pdb) print(large_string)
very large string with newline
another line in the large string
etc
(Pdb)
Run Code Online (Sandbox Code Playgroud)