Skip to content

Instantly share code, notes, and snippets.

@stilllisisi
Last active February 18, 2020 03:07
Show Gist options
  • Save stilllisisi/3ef55fb8c6ca8f50a90e17af3d52151a to your computer and use it in GitHub Desktop.
Save stilllisisi/3ef55fb8c6ca8f50a90e17af3d52151a to your computer and use it in GitHub Desktop.
【python-文件/目录处理】每天打开一个新的 markdown todo 文件的简单脚本。
from datetime import date
import os
# A simple script to open a new markdown todo file every day.
year = date.today().year
month = date.today().strftime('%b').lower()
day = date.today().day
filename = os.path.join(str(year) + '_' + month, str(day) + '.md')
try:
os.mkdir(os.path.abspath(str(year) + '_' + month))
except:
pass
file = open(filename, 'a')
file.close()
# replace this line with your way of opening markown files
os.system('start typora ' + filename)
# you could also just update a symbolic link and reference that link while opening your editor of choice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment