How to current Date and time in python with example

This tutorial explains multiple ways to check List is empty or not

Empty List contains zero elements in size and is denoted as []

For example, an Empty list can be declared as follows


In Real applications, Data comes from an API and returns a List.

Check List is empty or not

There are multiple ways we can check List is empty or not.

Here is an example

if not list the:
    print("Empty List")


Empty List
  • use a length of a list The len function returns the size of a list, Returns zero for an empty list.

Here is an example

if len(list) == 0:
   print("Empty List")
  • use empty brackets compares

use == operator that compares an empty list

if list == []:
   print("Empty List")
Join 6,000 subscribers and get a daily digest of full stack tutorials delivered to your inbox directly.No spam ever. Unsubscribe any time.

Similar Posts
You'll get a notification every time a post gets published here.