感谢。
答案 0 :(得分:2)
我会这样做:
from datetime import date, timedelta
def get_weekdays(year, week):
january_first = date(year, 1, 1)
monday_date = january_first + timedelta(days=week * 7 - january_first.weekday())
# monday, tuesday, .. sunday
return [(monday_date + timedelta(days=d)).day for d in range(7)]
(我的周从星期一开始)