Does Python actually contain a Boolean value? I know that you can do:
checker = 1
if checker:
#dostuff
But I'm quite pedantic and enjoy seeing booleans in Java. For instance:
Boolean checker;
if (someDecision)
{
checker = true;
}
if(checker)
{
//some stuff
}
Is there such a thing as a Boolean in Python? I can't seem to find anything like it in the documentation.
解决方案checker = None
if some_decision:
checker = True
if checker:
# some stuff
[Edit]
Your code works too, since 1 is converted to True when necessary.
Actually Python didn't have a boolean type for a long time (as in old C), and some programmers still use integers instead of booleans.