- TypeError
1 Python[ | ]
Python
Copy
result = 5 / '2'
# TypeError: unsupported operand type(s) for /: 'int' and 'str'
Python
Copy
def divide(a, b):
try:
result = a / b
except TypeError:
return False
return result
print( divide( 4, 2 ) )
print( divide( 4, '2' ) )
# 2.0
# False
Python
Copy
iter(1)
# TypeError: 'int' object is not iterable
2 같이 보기[ | ]
편집자 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.