This tutorial shows how you can get the current weekday in Python with 2 examples.
Method 1: use
Method 2: use
Examples of getting current weekday in Python
Example 1 for method 1
We can also check which weekday it is using
weekday(). It returns the day of the week as an integer, where Monday is 0 and Sunday is 6.
import datetime weekday_date = datetime.date.today().weekday() print("weekday:", weekday_date)
Example 2 for method 2
isoweekday() returns an integer to represent the day of the week. Different from
weekday() in Example 1,
isoweekday() returns 1 for Monday and 7 for Sunday.
import datetime weekday_date = datetime.date.today().isoweekday() print(weekday_date)