반응형
파이썬에서 들여쓰기를 하지 않는 경우
IndentationError: expected an indented block
와 같은 에러가 나타납니다
들여쓰기가 없는 경우
문제 코드:
def greet():
print("Hello, World!")
오류 메시지:
IndentationError: expected an indented block
해결 방법: 함수 블록 안의 코드는 들여쓰기를 사용해야 합니다.
def greet():
print("Hello, World!")
위와 같이 들여쓰기를 잘못 했을 경우 해당 들여쓰기를 해주게 되면 해당 오류는 없어지게 됩니다
#python #error #debug #indentatioinError #파이썬 #에러
반응형
'파이썬 > 에러 디버깅' 카테고리의 다른 글
IndentationError: unindent does not match any outer indentation level (0) | 2024.08.04 |
---|---|
IndentationError: unexpected indent (0) | 2024.08.04 |
SyntaxError: invalid syntax (0) | 2024.08.04 |
SyntaxError: unexpected EOF while parsing (0) | 2024.08.04 |
SyntaxError: expected an indented block (0) | 2024.08.04 |