GTD践行日志其二
前言
GTD(Getting Things Done)是一种强调将所有任务和想法捕捉到可靠系统中,将其分解为可行动的项目,并定期审查和更新的生产力方法。书接前文,对于大流程的文件夹进行了分类。其中需要对工作篮中的东西进行清理,在识别过后明确下一步行动。如果某个下一步行动明确,用时不超过2分钟,那就立即执行。这其中,把一些重复的(包括正常执行超过2分钟的)任务都集中,就可以使用电子邮件自动化来简化这些任务。
GTD的具体流程
《搞定》书中的工作流程图
尝试用python进一步简化流程
对于工作中有一些每周重复的邮件等进行了处理,部分实现如下:
- 发送每周例会通知
import smtplib
from email.mime.text import MIMEText
import time as t
import datetime
# 转换时间
weekday_dict = {
"Monday":"周一",
"Tuesday":"周二",
"Wednesday":"周三",
"Thursday":"周四",
"Friday":"周五",
"Saturday":"周六",
"Sunday":"周日",
}
today = datetime.date.today()
userinput = int(input('请输入一个天数(几天后开会):').strip())
userinput_ftime = str(input('请输入会议开始时间:')).strip()
userinput_ltime = str(input('请输入会议结束时间:')).strip()
meetday = today + datetime.timedelta(days = userinput)
English_weekday = meetday.strftime("%A")
Chinese_weekday = weekday_dict.get(English_weekday)
noticeday = str(meetday) + "(" + str(Chinese_weekday) + ")"
# 设置邮箱各项
mailto_list=["[email protected]"]
mailto_list_cc=["[email protected]"]
mail_host="xx.example.com.cn"
mail_user="xxxx"
mail_pass="xxxx"
mail_postfix="example.com.cn"
mail_content = """\
<html>
<head>
</head>
<body>
<p><b>会议主题</b>:XX团队周工作例会</p >
<p><b>会议内容</b>:本周核心工作总结及下周重点计划汇报</p >
<p><b>会议人员</b>:XX团队全体</p >
<p><b>会议时间</b>:{} {}-{}</p >
<p><b>会议地点</b>:会议室(N)</p >
</body>
</html>""" .format(noticeday,userinput_ftime,userinput_ltime)
def send_mail(to_list,to_cc,sub,content):
me="hello"+"<"+mail_user+"@"+mail_postfix+">"
msg = MIMEText(content,_subtype='html',_charset='gb2312')
msg['Subject'] = sub
msg['From'] = me
msg['To'] = ";".join(to_list)
msg['Cc'] = ";".join(to_cc)
try:
s = smtplib.SMTP()
s.connect(mail_host)
s.login(mail_user,mail_pass)
s.sendmail(me, to_list+to_cc, msg.as_string())
s.close()
return True
except Exception as e:
print (str(e))
return False
def run():
if send_mail(mailto_list,mailto_list_cc,"会议通知-----XX团队周工作例会",mail_content):
print ("发送成功")
else:
print ("发送失败")
if __name__ == '__main__':
run()
- 发送加班申请
import smtplib
from email.mime.text import MIMEText
import time as t
import datetime
import sys
today = (datetime.date.today()).strftime("%Y%m%d")
tomorrow = (datetime.date.today()+ datetime.timedelta(days = 1)).strftime("%Y%m%d")
while True:
userinput = (input('请选择加班日:1.今天;2.明天;其它任意键退出,按Enter确认').strip())
if userinput == "1":
now = today
print("已选择今日加班")
break
elif userinput == "2":
now = tomorrow
print("已选择明日加班")
break
else:
print("程序已退出")
sys.exit()
group = [
{'number':'1','name':'张三','id':'XXXXXX','adress':'XX团队','date':now,'f_time':'','l_time':'','reason':'XX项目开发','agree':'同意'},
{'number':'2','name':'李四','id':'XXXXXX','adress':'XX团队','date':now,'f_time':'','l_time':'','reason':'XX项目开发','agree':'同意'},
{'number':'3','name':'王五','id':'XXXXXX','adress':'XX团队','date':now,'f_time':'','l_time':'','reason':'XX项目开发','agree':'同意'},
{'number':'4','name':'赵六','id':'XXXXXX','adress':'XX团队','date':now,'f_time':'','l_time':'','reason':'XX项目开发','agree':'同意'},
{'number':'5','name':'钱七','id':'XXXXXX','adress':'YY团队','date':now,'f_time':'','l_time':'','reason':'XX跟进','agree':'同意'},
{'number':'6','name':'孙八','id':'XXXXXX','adress':'YY团队','date':now,'f_time':'','l_time':'','reason':'XX跟进','agree':'同意'},
{'number':'7','name':'吴九','id':'XXXXXX','adress':'YY团队','date':now,'f_time':'','l_time':'','reason':'XX跟进','agree':'同意'},
{'number':'8','name':'郑十','id':'XXXXXX','adress':'YY团队','date':now,'f_time':'','l_time':'','reason':'XX跟进','agree':'同意'},
]
persons = []
mailto_list = []
mailto_list_cc = []
choose = input("请选择你的团队:1.XX团队;2.YY团队;按其它任意键退出:")
while True:
if choose == "1":
workgroup = "XX团队"
break
elif choose == "2":
workgroup = "YY团队"
break
else:
print("程序已退出")
break
def work_person():
while True:
if choose == "1":
print("已选择XX团队")
whatsgroup = "XX团队"
mailto_list.extend(["[email protected]"])
mailto_list_cc.extend(["[email protected]"])
break
elif choose == "2":
print("已选择YY团队")
whatsgroup = "YY团队"
mailto_list.append("[email protected]")
mailto_list_cc.append("[email protected]")
break
else:
print("程序已退出")
break
for person in group:
if whatsgroup == person['adress']:
print(person['name']+"加班吗?")
while True:
whowork = (input("请输入y或n,按其它任意键退出:")).strip()
if whowork == "y" or whowork == "Y":
print(person['name']+"加定了,我说的")
howlong = (input("加几个钟(请输入整数):")).strip()
if now == tomorrow and int(howlong) > 6:
person['f_time'] = "8:30"
person['l_time'] = str(10+int(howlong))+":30"
else:
person['f_time'] = "17:30"
person['l_time'] = str(17+int(howlong))+":30"
persons.append(person)
break
elif whowork == "n" or whowork == "N":
print(person['name']+"不加啦不加啦")
break
else:
print("程序已退出")
sys.exit()
if len(persons) == 0:
print("请输入正确的团队")
return None
else:
return person
work_person()
mail_host="gm.gree.com.cn"
mail_user="58sa001"
mail_pass="szxzs!23"
mail_postfix="gree.com.cn"
mail_content = """\
<html>
<head>
</head>
<body>
<p>如下人员加班申请信息已提交,请跟进处理</p >
<table border="1" cellspacing="0" cellpadding="10">
<tr>
<th>序号</th>
<th>员工姓名</th>
<th>员工编号</th>
<th>所在科室</th>
<th>加班日期</th>
<th>加班申报起始时间</th>
<th>加班申报结束时间</th>
<th>加班原因</th>
<th>本科室审批意见</th>
</tr>
%s
</body>
</html>
""" % ''.join(['<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>' %
(person['number'], person['name'], person['id'], person['adress'], person['date'], person['f_time'], person['l_time'], person['reason'], person['agree'])
for person in persons])
'''
send_mail code
'''
def run():
if send_mail(mailto_list,mailto_list_cc,workgroup+now+"加班申请,请审批",mail_content):
print ("发送成功")
else:
print ("发送失败")
if __name__ == '__main__':
run()
类似的,可以根据自己的工作实际灵活使用,也可以通过设置电子邮件分类文件夹中及自动回复实现,当然这一块直接在邮箱中就可完成故不再列出。
后记
电子邮件自动化解放了一小部分的工作,通过将自动化与我们的判断和创造力相结合,一定可以在工作和个人生活中实现更高的生产力和效率。还是那句话
像实干家一样思考问题,像思想家一样付诸行动。
愿你我共同进步!
标签:GTD,person,list,践行,XX,time,print,mail,日志 From: https://www.cnblogs.com/yangor/p/17338448.html