python應用之複習計劃生成器

python應用之複習計劃生成器

原理:艾賓豪斯遺忘曲線

#ecoding=utf-8
from xlwt import Workbook
import datetime
w =Workbook()#創建一個工作簿
ws = w.add_sheet('1') #創建一個工作表
dayl=[1,2,4,8]
word_number=int(input("請輸入任務數(不大於15):"))
exam_date=input("請輸入您的考試日期(格式爲:2019/1/1):")
subject_name=input("請輸入您的考試科目:")
year,month,day=exam_date.split("/")

total_day=word_number+8
letter_l=[chr(i) for i in range(65, 65+word_number)]

exam_date=datetime.date(int(year),int(month),int(day))
today_date=datetime.date.today()
diminish_date=str(exam_date.__sub__(today_date).days)
print('今天距考試還有'+diminish_date+'天,本計劃共需要'+str(total_day)+'天完成複習,建議您從'+str(exam_date+datetime.timedelta(days=-(total_day+1)))+'開始複習'+subject_name)

ws.write(1,0,'需要複習')
ws.write(2,0,'打卡情況')
for i in range(1,total_day):
    ws.write(0,i,i)

for i in range(1,total_day):
    s = ""
    for t in dayl:
        if i - t >= 0 and i - t <len(letter_l):
            s += letter_l[i - t]
    ws.write(1, i, s)
save_path='/home/sun/桌面/複習計劃'+subject_name+str(word_number)+'章版.xls'
w.save(save_path)
print(subject_name+'複習計劃表已生成!存儲位置:'+save_path)


效果如下:
在這裏插入圖片描述
在這裏插入圖片描述
2019.12.16更新:新增了可選擇複習的輪數和預留做題的天數!

#ecoding=utf-8
from xlwt import Workbook
import datetime
w =Workbook()#創建一個工作簿
ws = w.add_sheet('1') #創建一個工作表
dayl=[1,2,4,8,15,30]
word_number=int(input("請輸入任務數(不大於15):"))
times_number=int(input("請輸入您要複習的輪數(不大於6輪):"))
exercise_number=int(input("請輸入您希望預留的做題天數:"))
exam_date=input("請輸入您的考試或希望完成複習的日期(格式爲:2019/1/1):")
subject_name=input("請輸入您的考試科目:")
year,month,day=exam_date.split("/")

total_day=word_number+dayl[times_number-1]
letter_l=[chr(i) for i in range(65, 65+word_number)]
dayl=dayl[0:times_number]
exam_date=datetime.date(int(year),int(month),int(day))
today_date=datetime.date.today()
diminish_date=str(exam_date.__sub__(today_date).days)
print('今天距考試還有'+diminish_date+'天,本計劃共需要'+str(total_day+exercise_number)+'天完成複習'+',其中預留'+str(exercise_number)+'天做題,建議您從'+str(exam_date+datetime.timedelta(days=-(total_day+1)))+'開始複習'+subject_name)

ws.write(2,0,'需要複習')
ws.write(3,0,'打卡情況')
for i in range(1,total_day):
    ws.write(1,i,i)

for i in range(1,total_day):
    s = ""
    for t in dayl:
        if i - t >= 0 and i - t <len(letter_l):
            s += letter_l[i - t]
    ws.write(2, i, s)
s=subject_name+'考試日期爲'+str(exam_date)+',本計劃共需要'+str(total_day+exercise_number)+'天完成複習'+',其中預留'+str(exercise_number)+'天做題,建議您從'+str(exam_date+datetime.timedelta(days=-(total_day+1)))+'開始複習'
ws.write(0,0,s)



save_path='/home/sun/桌面/複習計劃'+subject_name+str(word_number)+'章版.xls'
w.save(save_path)
print(subject_name+'複習計劃表已生成!存儲位置:'+save_path)


效果如下:
在這裏插入圖片描述
在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章