Created
May 30, 2015 22:12
-
-
Save guori12321/679033e7345f59f698dc to your computer and use it in GitHub Desktop.
一个为JustWriting新建中文题目博文的小脚本
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
#!/usr/bin/env python | |
import sys | |
import time | |
from pypinyin import pinyin, lazy_pinyin | |
import pypinyin | |
py = lazy_pinyin(unicode("_".join(sys.argv[1:]), "utf-8")) | |
fileName = ''.join(py) | |
print fileName | |
with open(time.strftime("%Y-%m-%d-")+fileName+'.md', 'a') as fin: | |
fin.write("Date: %s\n" % time.strftime("%Y-%m-%d")); | |
fin.write("Title: %s\n" % " ".join(sys.argv[1:])) | |
fin.write("Tags: Tech\n") | |
fin.write("Status: draft\n\n") | |
from subprocess import call | |
call(["mvim", time.strftime("%Y-%m-%d-")+fileName+'.md']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment