I am wondering if python has any function such as php empty function (http://php.net/manual/en/function.empty.php) which check if the variable is empty with following criteria
"" (an empty string)
0 (0 as an integer)
0.0 (0 as a float)
"0" (0 as a string)
NULL
FALSE
array() (an empty array)
Yes,
bool. It’s not exactly the same —'0'isTrue, butNone,False,[],0,0.0, and""are allFalse.boolis used implicitly when you evaluate an object in a condition like aniforwhilestatement, conditional expression, or with a boolean operator.If you wanted to handle strings containing numbers as PHP does, you could do something like: