4
I’m starting at the python
and always end up appearing some doubts at the beginning.
I need to know how to test if a list
is empty.
As I always say, I come from PHP.
So I used to make these shapes:
count($array) == 0
empty($array);
!$array
How to do this in python
?
Example:
a = [1, 2, 3]
b = []
# a é vazio?
# b é vazio?
+1. Very, very simple indeed!
– Wallace Maxters
Adding, "if not" is executed when the value is zero, empty or false.
– mauricio caserta