About 3,030,000 results
Open links in new tab
  1. How do I use a Boolean in Python? - Stack Overflow

    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;...

  2. Converting from a string to boolean in Python - Stack Overflow

    Since Python 2.6 you can use ast.literal_eval, and it's still available in Python 3. Evaluate an expression node or a string containing only a Python literal or container display. The string or node provided may …

  3. Syntax for an If statement using a boolean - Stack Overflow

    I just recently joined the python3 HypeTrain. However I just wondered how you can use an if statement onto a boolean. Example: RandomBool = True # and now how can I check this in an if statement? L...

  4. How to use boolean 'and' in Python - Stack Overflow

    Dec 8, 2013 · How to use boolean 'and' in Python [duplicate] Asked 16 years, 9 months ago Modified 11 years, 11 months ago Viewed 286k times

  5. How do I get the opposite (negation) of a Boolean in Python?

    Do not use the bitwise invert operator ~ on booleans One might be tempted to use the bitwise invert operator ~ or the equivalent operator function operator.inv (or one of the other 3 aliases there). But …

  6. python - Check if object is a number or boolean - Stack Overflow

    The Boolean type is a subtype of the integer type, and Boolean values behave like the values 0 and 1, respectively, in almost all contexts, the exception being that when converted to a string, the strings …

  7. python - Parsing boolean values with argparse - Stack Overflow

    @AnatolyAlekseev, argparse developers are fully aware that some users try to handle strings like "True" or "False" as booleans, but have rejected proposals to redefine the basic Python bool function. …

  8. Converting "true" (JSON) to Python equivalent "True"

    Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'false' is not defined If I am not mistaken, I think this is because the boolean value in the JSON response is false / …

  9. Evaluate boolean environment variable in Python - Stack Overflow

    Jul 27, 2020 · How can I evaluate if a env variable is a boolean True, in Python? Is it correct to use:

  10. How are booleans formatted in Strings in Python?

    4 To expand on the answer by phd, you can do all that without str() -ing your booleans in the format() call. There are some weird tricks you can exploit to do formatting for booleans with the new style of …