Indentation of IF-ELSE block in python

前端 未结 7 1270
青春惊慌失措
青春惊慌失措 2020-12-11 08:48

Hi I am python newbie and I am working on NLP using python. I am having a error in writing if-else block in python. When I am writing only if block at that time it is workin

7条回答
  •  -上瘾入骨i
    2020-12-11 09:40

    " -- when I use space to come to the correct pointer it is giving me a error" Of course. Using space never makes a "line break", typically this is \n in Unix systems. If you'd open your .py file in a different editor (say notepad in windows) you'd see that your else statement is in the same line as print.

    " -- enter is clearly not working because it is taking the cursor forward --" Press backspace the correct amount of times to reach the same level of indentation as your IF statement.

提交回复
热议问题