파이썬 오류 해결 사전
파이썬에서 자주 만나는 오류예요. 오류 글과 같은 것을 골라 보세요. 문법이 헷갈리면 파이썬 문법 레퍼런스도 있어요.
AttributeError: 'NoneType' object has no attribute 'append'None인 값에 점을 찍어 무언가를 하려 했을 때EOFError: EOF when reading a line더 읽을 입력이 없는데 input()을 불렀을 때IndentationError: expected an indented block들여쓰기가 빠졌거나 칸 수가 맞지 않을 때IndexError: list index out of range리스트에 없는 번호의 칸을 꺼내려 했을 때KeyError: 'kiwi'딕셔너리에 없는 키로 값을 꺼내려 했을 때NameError: name 'x' is not defined만든 적 없는 이름을 썼을 때SyntaxError: invalid syntax파이썬 문법에 맞지 않는 줄이 있을 때TypeError: can only concatenate str (not "int") to str문자열에 + 로 수를 붙이려 했을 때TypeError: add() missing 1 required positional argument: 'b'함수가 받기로 한 값보다 적게 넘겼을 때TypeError: 'int' object is not callable함수가 아닌 값 뒤에 소괄호를 붙였을 때TypeError: 'int' object is not iterable하나씩 꺼낼 수 없는 값을 for 문에 넣었을 때TypeError: 'int' object is not subscriptable대괄호로 꺼낼 수 없는 값에 [ ]를 썼을 때TypeError: unsupported operand type(s) for +: 'int' and 'str'계산할 수 없는 두 값을 + - * / 로 묶었을 때ValueError: invalid literal for int() with base 10: '3 5'정수로 바꿀 수 없는 글자를 int()에 넣었을 때ValueError: not enough values to unpack (expected 2, got 1)변수 개수보다 값이 적게 들어왔을 때ZeroDivisionError: division by zero어떤 수를 0으로 나누려 했을 때