is compares identity. A string will never be identical to a not-string.

== is equality. But a string will never be equal to either True or False.

You want neither.

path = '/bla/bla/bla'

if path:
    print "True"
else:
    print "False"
Answer from Ignacio Vazquez-Abrams on Stack Overflow
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_booleans.asp
Python Booleans
Any list, tuple, set, and dictionary are True, except empty ones. ... In fact, there are not many values that evaluate to False, except empty values, such as (), [], {}, "", the number 0, and the value None.
๐ŸŒ
Mimo
mimo.org โ€บ glossary โ€บ python โ€บ value-false
False Values in Python: Unveiling True and False
The None object, which denotes the absence of a value or a null value in Python ยท Falsy values allow for concise and expressive conditional checks. Instead of checking if a list is empty by comparing its length to 0, you can also use the list itself: ... my_list = [] if not my_list: # This evaluates to True because an empty list is falsy print("The list is empty.")
Discussions

(not True) vs (False)
Boolean logic has only 2 states, true and false. Therefore one can understand why False and not True are logically equivalent. When working in Python it's common not to write True or False. Instead of writing if x == True: we commonly write if X: and instead of writing if x == False: we commonly write if not x:. More on reddit.com
๐ŸŒ r/Python
28
2
February 1, 2023
boolean - 'True' and 'False' in Python - Stack Overflow
Explore Stack Internal ... Closed 2 years ago. ... And it prints False. I thought Python treats anything with value as True. Why is this happening? ... You want neither. path = '/bla/bla/bla' if path: print "True" else: print "False" ... Sign up to request clarification or add additional context ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
python - why is the expression "true or true and false" true? - Stack Overflow
Python documentation gives you the operator precedence, including that "and" is higher than "or". Where are you confused? ... Sign up to request clarification or add additional context in comments. ... @J.DF If you are not sure why True or False is True, please do own research about boolean logic. More on stackoverflow.com
๐ŸŒ stackoverflow.com
python - Boolean identity == True vs is True - Stack Overflow
The bool constructor will return ... True or False using is. ... Thanks guys, found the actual source as well. PEP 285 ... PEP 285 might say that True and False are singletons, but they're not. At least not in the sense that "singleton" means everywhere else in Python documentation: ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ check-for-true-or-false-in-python
Check for True or False in Python - GeeksforGeeks
July 23, 2025 - a = 10 b = 10 # checking the value using the equality operator print(a == b) # checking the value using inequality operator print(a != b) ... Logical Operators (and, or, not) allow combining multiple conditions. ... a = True b = False # Using different logical operators print(a and b) # False (both conditions must be True) print(a or b) # True (at least one condition is True) print(not a) # False (negation of True)
๐ŸŒ
Real Python
realpython.com โ€บ python-boolean
Python Booleans: Use Truth Values in Your Code โ€“ Real Python
June 16, 2023 - Because it uses an inclusive or, the or operator in Python also uses short-circuit evaluation. If the first argument is True, then the result is True, and there is no need to evaluate the second argument.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ boolean-data-type-in-python
Python Boolean - GeeksforGeeks
July 23, 2025 - In Python, integers and floats can be used as Boolean values with the bool() function. Any number with a value of zero (0, 0.0) is considered False while any non-zero number (positive or negative) is considered True.
๐ŸŒ
Uwaterloo
open.cs.uwaterloo.ca โ€บ python-from-scratch โ€บ 5 โ€บ 3 โ€บ transcript
Booleans in Python (Part 1)
We capitalize True and False but not or, and, and not. For example, running the code ยท print(True or False) print(True and False) print(not False) ... In Python, True and False are built-in Boolean constants, just like 1, 2, and 3 are built-in numerical constants.
Find elsewhere
๐ŸŒ
Medium
medium.com โ€บ @sydasif78 โ€บ leveraging-third-party-python-packages-for-network-engineering-26ded11ad03d
Boolean and None in Python | Medium
October 23, 2023 - The Boolean values are case-sensitive in Python, so True and False must be written with an uppercase initial letter. Using lowercase, such as true, or false, will result in a NameError.
๐ŸŒ
Mimo
mimo.org โ€บ glossary โ€บ python โ€บ value-true
Python True: Understanding Boolean Values | Learn Python
In Python, True is a built-in constant that represents the boolean value of true. Alongside False, True enables logical and conditional operations. You can assign True directly to a variable or get True as a result of comparisons or logical operations.
๐ŸŒ
Great Learning
mygreatlearning.com โ€บ blog โ€บ python tutorial โ€บ python booleans (true and false)
Python Booleans: True and False Values
November 24, 2025 - Comparison operators look at two values and return True if the statement is accurate, or False if it isn't. You don't normally type True or False directly - instead, Python evaluates an expression and gives you one of them.
๐ŸŒ
Codecademy
codecademy.com โ€บ forum_questions โ€บ 557cb8d5937676789d00009e
Python True and False | Codecademy
True and False are values in Python, as are numbers and strings. They are of the type bool, meaning boolean. You can think of them as meaning, literally, what their common meanings imply.
๐ŸŒ
Hyperskill
hyperskill.org โ€บ university โ€บ python โ€บ boolean-values-in-python
Boolean Values in Python
July 22, 2024 - In Python we can assess values using various comparison operators like equal to (==), not equal to (!=) greater than (>) less than (<) greater than or equal to (>=) and less than or equal to (<=). These operators return either True or False based on the outcome of the comparison.
๐ŸŒ
Switowski
switowski.com โ€บ blog โ€บ checking-for-true-or-false
Checking for True or False - Sebastian Witowski
In Python (and many other languages), there is True, and there are truthy values. That is, values interpreted as True if you run bool(variable). Similarly, there is False, and there are falsy values (values that return False from bool(variable)).
๐ŸŒ
Note.nkmk.me
note.nkmk.me โ€บ home โ€บ python
Convert Between bool (True/False) and Other Types in Python | note.nkmk.me
May 12, 2025 - Built-in Functions - bool() โ€” Python 3.13.3 documentation ยท Any non-empty string, including 'True' and 'False', is treated as True. Only an empty string becomes False.
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ truthy-and-falsy-values-in-python
Truthy and Falsy Values in Python: A Detailed Introduction
January 22, 2020 - ... Values that evaluate to False are considered **Falsy**. Values that evaluate to True are considered **Truthy**. ... Any object can be tested for truth value, for use in an if or while condition or as operand of the Boolean operations below ...