from datetime import date, timedelta, datetime
import time
firstDay = '1-January-2000'
lastDay = '22-february-2000'
weekDay = 'Monday'
firstDay = datetime.strptime(firstDay, '%d-%B-%Y')
lastDay = datetime.strptime(lastDay, '%d-%B-%Y')
dates = [firstDay + timedelta(days=x) for x in range((lastDay-firstDay).days + 1) if (firstDay + timedelta(days=x)).weekday() == time.strptime(weekDay, '%A').tm_wday]
вывод
dates
[datetime.datetime(2000, 1, 3, 0, 0),
datetime.datetime(2000, 1, 10, 0, 0),
datetime.datetime(2000, 1, 17, 0, 0),
datetime.datetime(2000, 1, 24, 0, 0),
datetime.datetime(2000, 1, 31, 0, 0),
datetime.datetime(2000, 2, 7, 0, 0),
datetime.datetime(2000, 2, 14, 0, 0),
datetime.datetime(2000, 2, 21, 0, 0)]
вывод в формате weekDay-Month-year
[d.strftime("%A-%B-%Y") for d in dates]
['Monday-January-2000',
'Monday-January-2000',
'Monday-January-2000',
'Monday-January-2000',
'Monday-January-2000',
'Monday-February-2000',
'Monday-February-2000',
'Monday-February-2000']
вывод в формате firstDay
: 1-January-2000
[d.strftime("%-d-%B-%Y") for d in dates]
['3-January-2000',
'10-January-2000',
'17-January-2000',
'24-January-2000',
'31-January-2000',
'7-February-2000',
'14-February-2000',
'21-February-2000']