0
Indentation error: expected an indented block
3 Respostas
+ 5
hi,
In python u must follow indentation while writing code but in other lang like java uses curly braces.
please use IDLE Python for avoiding such error.
+ 3
use an appropriate editor or IDE
can you please post the exact code?
0
There is one extremely common case in which you will encounter that error - when you are trying to create an empty code block, to be filled in later. For example when you are trying to create an empty function:
def function_i_need_but_will_actually_write_later():
def another_function():
print ("This one actually has content")
The problem is that python requires any code block to have at least one line inside it. So for this exact reason, you have the "pass" keyword - it doesn't do anything, but it allows you to have that required line:
def function_i_need_but_will_actually_write_later():
pass
def another_function():
print ("This one actually has content")