TypeError

TypeError

1 Python[ | ]

result = 5 / '2'
# TypeError: unsupported operand type(s) for /: 'int' and 'str'
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
iter(1)
# TypeError: 'int' object is not iterable

2 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}