iterweekdays() 在 python 中的含义是什么?
iterweekdays() 方法。iterweekdays() 方法返回一个一周的星期几数字的迭代器。
示例
#Write a python program to print iterweekdays() using list import calendar # prints firstweekday starts with 4 th day day= calendar.Calendar(firstweekday = 4) list(day.iterweekdays())
输出
[4, 5, 6, 0, 1, 2, 3]
或
import calendar #prints firstweekday starts with 0 th day variable= calendar.Calendar(firstweekday = 0) for day in variable.iterweekdays(): print(day)
输出
0 1 2 3 4 5 6
广告