Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to paste multiple lines to an ipdb shell in python?

Tags:

python-2.7

I am working with python and ipdb debugger. Let's say is set some breaking point in some line in a python file. Now, after running the python file, the program stops at the breakpoint. I want to be able to paste multiple lines to the ipdb shell. Now i get an error, if trying to paste mutiple lines. How can i paste mutiple lines?

Thanks.

like image 849
avichoen Avatar asked Nov 26 '15 09:11

avichoen


1 Answers

As far as I know, you cannot simply paste them. You have to use ; to indicate indentation. For example:

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

would be equivalent to

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

If you want the hello out of the loop, then you need to use ;; instead:

for i in range(10): print i;; print("hello")
like image 71
toto_tico Avatar answered Nov 04 '22 15:11

toto_tico