【问题标题】:How to paste multiple lines to an ipdb shell in python?如何将多行粘贴到python中的ipdb shell?
【发布时间】:2016-02-29 07:04:25
【问题描述】:

我正在使用 python 和 ipdb 调试器。 假设在 python 文件的某行中设置了一些断点。 现在,运行 python 文件后,程序在断点处停止。 我希望能够将多行粘贴到 ipdb shell。 现在我得到一个错误,如果试图粘贴多行。 如何粘贴多行?

谢谢。

【问题讨论】:

标签: python-2.7


【解决方案1】:

据我所知,您不能简单地粘贴它们。您必须使用; 来表示缩进。例如:

for i in range(10): print i; print("hello")

相当于

for i in range(10): 
    print(i)
    print("hello")

如果您希望 hello 退出循环,则需要使用 ;; 代替:

for i in range(10): print i;; print("hello")

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-06-03
    • 2023-03-22
    • 2021-04-17
    • 2017-06-16
    • 2013-06-18
    • 1970-01-01
    • 2016-04-25
    • 2015-03-18
    相关资源
    最近更新 更多