stay Python in , Except that the Boolean values of the following objects are False, Everything else is True.
You can use built-in functions bool() Determine the Boolean value of an object , The sample code is as follows :
bool1 = bool([])
bool2 = bool(())
bool3 = bool({
})
bool3 = bool('')
bool4 = bool(False)
bool5 = bool(0)
bool5 = bool(None)
bool6 = bool(-5)
bool7 = bool(6)
bool8 = bool(7.5)
bool9 = bool('su')
The operation results are as follows :