今日はプレミアムフライデーですね。
# -*- coding: utf-8 -*-
import datetime
import calendar
def get_premium_friday_list(year):
pre_fri_list = []
for month in range(1, 13):
lastfri = max(week[calendar.FRIDAY] for week in calendar.monthcalendar(year, month))
pre_fri = '{}-{}-{}'.format(year, month, lastfri)
pre_fri_list.append(pre_fri)
return pre_fri_list
def main():
now = datetime.datetime.now()
date = now.strftime('%Y-%m-%d')
if date in get_premium_friday_list(now.year):
# プレ金だったときのなにか
if __name__ == '__main__':
main()