Last active
October 28, 2020 16:01
-
-
Save funasoul/af83c0197bc9a6a7f8dd0fee929a1122 to your computer and use it in GitHub Desktop.
Google Form で日程調整をする時に便利。Google Form でチェックボックスにして、以下のスクリプトの実行結果をペーストするだけ。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# vim: set fileencoding=utf-8 : | |
# -*- coding: utf-8 -*- | |
# | |
# Last modified: Thu, 29 Oct 2020 00:50:55 +0900 | |
from datetime import timedelta, date | |
import locale | |
# https://stackoverflow.com/a/1060330 | |
def daterange(start_date, end_date): | |
for n in range(int((end_date - start_date).days)+1): | |
yield start_date + timedelta(n) | |
def main(): | |
locale.setlocale(locale.LC_TIME, 'ja_JP.UTF-8') | |
start_date = date(2021, 2, 22) | |
end_date = date(2021, 3, 20) | |
for single_date in daterange(start_date, end_date): | |
if single_date.weekday() != 6: # 日曜日以外 | |
print(single_date.strftime("%Y年%-m月%d日(%a)")) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment