2

I want to write such a structured command in multiple lines

for i in range(10):
    if i > 2:
        print(i)
    else:
        print("else")

However, it break automatically

In [58]: for i in range(10): 
    ...:     if i > 2: 
    ...:         print(i)                                                                                         
3
4
5
6
7
8
9

I think it is facile to write as shell script in terminal

$ for i in 1 2 3
→ do echo $i
→ done
1
2
3

How could I set the ipython to control multiple lines input?

AbstProcDo
  • 19,953
  • 19
  • 81
  • 138
  • 1
    it works fine for me. see https://ibb.co/n9si00 – Seeni Nov 01 '18 at 04:49
  • after every line put spaces before code, and end statement with backslash. for example: ``...if i > 2: \`` and so on. – BSeitkazin Nov 01 '18 at 04:57
  • how do you make it ?@Seenivasan – AbstProcDo Nov 01 '18 at 05:00
  • This is a temporary (hopefully) problem with a recent release of Ipython/Jupyter. It's come up in other recent SO questions. Solution - go back to 6.5. Or use `ctrl-o` to continue with indented lines. – hpaulj Nov 01 '18 at 06:05
  • https://stackoverflow.com/questions/52912257/why-does-continuation-line-break-right-after-if-block-on-ipython – hpaulj Nov 01 '18 at 06:06

0 Answers0