w3resource

Python Calendar Module: iterweekdays() method

iterweekdays() method

The iterweekdays() method returns an iterator for the weekday numbers that will be used for one week. The first number from the iterator will be the same as the number returned by firstweekday().

Syntax

iterweekdays()

Example -1: Python iterweekdays() method

import calendar
#set firstweekday=0
cal= calendar.Calendar(firstweekday=0)
for x in cal.iterweekdays():
	print(x)

Output:

0
1
2
3
4
5
6

Example - 2: iterweekdays() method

import calendar
#set firstweekday=1
cal= calendar.Calendar(firstweekday=1)
for x in cal.iterweekdays():
print(x)

Output:

1
2
3
4
5
6
0

Note: firstweekday() - Return an array for one week of weekday numbers starting with the configured first one.

Previous: Home - Python Calendar Module
Next: itermonthdates()

Test your Python skills with w3resource's quiz



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://198.211.115.131/python/module/calendar/iterweekdays.php