from datetime import datetime,timedelta,date
days = {0: u"Понедельник", 1: u"Вторник", 2: u"Среда", 3: u"Четверг", 4: u"Пятница", 5: u"Суббота", 6: u"Воскресенье"}
firstDate = '31122020'
secondDate = '01012012'
f_date = datetime.strptime(firstDate,'%d%m%Y').date()
s_date = datetime.strptime(secondDate,'%d%m%Y').date()
dates_2020 = []
delta = timedelta(days=1)
while s_date <= f_date:
s_date += delta
dates_2020.append(days[s_date.weekday()] + ':' + s_date.strftime('%m.%d'))
for i in dates_2020:
print(i)
Четверг:12.24
Пятница:12.25
Суббота:12.26
Воскресенье:12.27
Понедельник:12.28
Вторник:12.29
Среда:12.30
Четверг:12.31
months_range = [31,29,31,30,31,30,31,31,30,31,30,31]
weeks = ["сред","чет","пят","суб","вос","пон","вто"]
def ret_2020(months_range,weeks):
MR = months_range
WK = weeks
week = 0
for month in range(len(MR)):
for days in range(MR[month]):
print(month+1,":",days+1," ",weeks[week])
week += 1
if week >= 7:
week = 0
ret_2020(months_range,weeks)