파이썬/에러 디버깅

IndentationError: expected an indented block

kimble2 2024. 8. 4. 15:54
반응형

 

파이썬에서 들여쓰기를 하지 않는 경우

 

IndentationError: expected an indented block

 

와 같은 에러가 나타납니다

 

 

들여쓰기가 없는 경우

문제 코드:

def greet():
print("Hello, World!")
 

오류 메시지:

IndentationError: expected an indented block
 

해결 방법: 함수 블록 안의 코드는 들여쓰기를 사용해야 합니다.

def greet():
    print("Hello, World!")
 

 

위와 같이 들여쓰기를 잘못 했을 경우 해당 들여쓰기를 해주게 되면 해당 오류는 없어지게 됩니다

 

#python #error #debug #indentatioinError #파이썬 #에러

 

반응형