You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
364 B
14 lines
364 B
from datetime import timedelta
|
|
from collections import Counter
|
|
|
|
|
|
def date_range(start, end):
|
|
delta = end - start
|
|
for d in range(delta.days + 1):
|
|
yield start + timedelta(days=d)
|
|
return
|
|
|
|
|
|
def weekday_in_date_range(start, end, weekday):
|
|
counter = Counter([d.isoweekday() for d in date_range(start, end)])
|
|
return counter.get(weekday, None)
|
|
|