0 works

Check if a list is empty in Python


dashboard

Posted by @bravocoder #python

a = []

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

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

https://stackoverflow.com/questions/53513/how-do-i-check-if-a-list-is-empty

>> Browse more code snippets

more_vert