Python Check if Today is Thursday or not Example

06-Sep-2022

.

Admin

Python Check if Today is Thursday or not Example

Hi Dev,

Today, Python Check if Today is Thursday or not Example is our main topic. this example will help you Python Check Date is Thursday or not. you can see Check Today is Thursday in Python. this example will help you Python Today is Thursday.

In this example, we will use DateTime library to check whether today is Thursday or not. I will give you two simple examples one using weekday() and another using isoweekday(). so let's see both examples:

so let's see following examples with output:

Example 1:


main.py

from datetime import datetime

# If today is Thursday (0 = Mon, 1 = Tue, 2 = Wen ...)

if datetime.today().weekday() == 3:

print("Yes, Today is Thursday")

else:

print("Nope...")

Output:

Yes, Today is Thursday

Example 2:

main.py

from datetime import datetime

# If today is Thursday (1 = Mon, 2 = Tue, 3 = Wen ...)

if datetime.today().isoweekday() == 4:

print("Yes, Today is Thursday")

else:

print("Nope...")

Output:

Yes, Today is Thursday

#Python