0 works

Check if a list is empty in Python


dashboard+ Project

Posted by @bravocoder #python

Code snippet:

a = []

if not a:
  print("List is empty")
content_copyCopy to Clipboard

More details:

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

Code snippet source:

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

>> Browse more code snippets

more_vert