Last active
September 1, 2021 12:30
-
-
Save Gummary/39df643c77e70457723f3a9f29da235c to your computer and use it in GitHub Desktop.
周计划生成模板
This file contains 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
from datetime import datetime, timedelta | |
day_mapper = { | |
0:'天', | |
1:'一', | |
2:'二', | |
3:'三', | |
4:'四', | |
5:'五', | |
6:'六', | |
} | |
head_template = """ | |
[TOC] | |
# 本周总结 | |
TODO | |
# 周计划 | |
| 角色 | 任务 | | |
| ---- | ---- | | |
| 员工 | | | |
| 朋友 | | | |
| 自我提升 | | | |
# 日计划 | |
""" | |
daily_template = """ | |
## {day}-周{weekday} | |
**TODO** | |
- [ ] xxx | |
**Thinkings** | |
1. xxx | |
""" | |
start_day = "20210920" # input("Please input start day(yyyyMMdd):") | |
start_date_time = datetime.strptime(start_day, "%Y%m%d") | |
plan_file = datetime.strftime(start_date_time, "%Y年%m月第x周.md") | |
fp = open(plan_file, "w") | |
fp.write(head_template) | |
for i in range(7): | |
current_day = datetime.strftime(start_date_time, "%Y%m%d") | |
weekday = int(datetime.strftime(start_date_time, "%w")) | |
fp.write(daily_template.format(day=current_day, weekday=day_mapper[weekday])) | |
start_date_time = start_date_time + timedelta(days=1) | |
fp.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment