Can anybody tell me why the following fails:
teststr = "foo"
if not teststr.isdigit() and int(teststr) != 1:
pass
with:
ValueError: invalid literal for int() with base 10: 'foo'
In C if the first part in an &&
test fails the right hand side is not evaluated anymore. Is this different in Python?
EDIT: I am being stupid. The and
should be an or
of course.....