How do I check if a list is empty?

Submitted 5 years ago
Ticket #203
Views 441
Language/Framework Python
Priority Low
Status Closed

For example, if passed the following:

a = []

How do I check to see if a is empty?

Submitted on Oct 04, 20
add a comment

1 Answer

Verified

if not a:
  print("List is empty")

Using the implicit booleanness of the empty list is quite pythonic.

Submitted 5 years ago


Latest Blogs