gpt4 book ai didi

python - 在 python pdb 中打印\n 换行符作为实际换行符

转载 作者:太空宇宙 更新时间:2023-11-03 13:39:56 27 4
gpt4 key购买 nike

当我在 pdb 中并且我有一个大字符串时,有时我想用换行符将其作为实际换行符打印出来,而不是在终端中将它们视为\n。

(Pdb) p large_string
"very large string with newline\nanother line in the large string\n\netc\n"

我宁愿看

(Pdb) printwithnewline large_string
"very large string with newline
another line in the large string

etc
"

有什么建议吗?

最佳答案

只需调用普通的打印函数:

(Pdb) print(large_string)
very large string with newline
another line in the large string

etc
(Pdb)

关于python - 在 python pdb 中打印\n 换行符作为实际换行符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33332403/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com