to boolean python code example
Example 1: convert string to boolean python
def str2bool(v):
return str(v).lower() in ("yes", "true", "t", "1")
Example 2: python bool()
# Returns the boolean value of the specified object
x = bool(1) # outputs True