How do I check if a list is empty?

Submitted 3 years, 6 months ago
Ticket #203
Views 252
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 3 years, 6 months ago


Latest Blogs