devxlogo

How to Check if a List is Empty in Python

How to Check if a List is Empty in Python

Use one of the following methods to check if a list is empty in Python:

a.   If not listname: print("list is empty")b.   if len(listname) == 0:    print("list is empty')

devx-admin

Share the Post: