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)
Best Answer
See also this previous answer which recommends the
not
keywordHow to check if a list is empty in Python?
It generalizes to more than just lists:
Notably, it will not work for "0" as a string because the string does in fact contain something - a character containing "0". For that you have to convert it to an int: