Python Check if Today is Tuesday or not Example
Published On: 26/09/2022 | Category:
Python

Hi Guys,
This post will give you example of python check date is tuesday or not. This tutorial will give you simple example of how to check if today is tuesday in python. This post will give you simple example of how to check if today is tuesday in python. We will look at example of python today is tuesday.
In this example, we will use DateTime library to check whether today is Tuesday or not. I will give you two simple examples one using weekday() and another using isoweekday(). so let's see both examples:
You can use these examples with python3 (Python 3) version.
So let's see bellow example:
Example 1:
main.pyfrom datetime import datetime # If today is Tuesday (0 = Mon, 1 = Tue, 2 = Wen ...) if datetime.today().weekday() == 1: print("Yes, Today is Tuesday") else: print("Nope...")Output:
Yes, Today is Tuesday
Example 2:
main.pyfrom datetime import datetime # If today is Tuesday (1 = Mon, 2 = Tue, 3 = Wen ...) if datetime.today().isoweekday() == 2: print("Yes, Today is Tuesday") else: print("Nope...")Output:
Yes, Today is Tuesday
It will help you....
Happy Pythonic Coding!