If you want to check if a list is empty in Python, then use the following Python code.
1 2 |
if not a: print("List is empty") |
Using the implicit booleanness of the empty list
is quite pythonic.
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.