__2017-12-16 如一模式识别研究

如一模式识别研究

python>>获取系统时间,到30时,发邮件出去

from os.path import join, getsize from email.header import Header from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart import smtplib, datetime

def liveCallTimer():

global liveCallflag

nowtime=datetime.datetime.now()

if nowtime.second>=30 and liveCallflag==1:

liveCallflag=0

liveCall()

elif nowtime.second<30 and liveCallflag==0:

liveCallflag=1

def liveCall():

global n_of_file

dir_size = getdirsize(start_dir)

now = datetime.datetime.now()

year = now.year

hour = now.hour

minute = now.minute

second = now.second

timestr = "时间:[{0:d}年{1:d}月{2:d}日 {3:d}:{4:d}:{5:d}]".format(now.year, now.month, now.day, now.hour, now.minute,now.second)

text = " "+timestr+" "+start_dir + "["+str(dir_size)+"Mbytes],files number["+str(n_of_file)+"]"

msg = MIMEMultipart()

# att = MIMEText(open('D:\\img3\\318094063\\large_hzqZ_49ed0000aec1118e.jpg', 'rb').read(), 'base64', 'gb2312')

# att["Content-Type"] = 'application/octet-stream'

# att["Content-Disposition"] = 'attachment; filename="zhanghongwei.jpg"'

# msg.attach(att)

msg['to'] = 'xxxxxxxxxxxx@xxxx.com'

msg['from'] = 'xxxxxxxxxx@qq.com'

msg['subject'] = Header(text+' (' + str(datetime.date.today()) + ')','gb2312')

server = smtplib.SMTP('smtp.qq.com')

server.login('471106585@qq.com','0304028Pp')

error=server.sendmail(msg['from'], msg['to'], msg.as_string())

server.close()

print(error)

评论留言区

:
  

作者: 游客 ; *
评论内容: *
带*号为必填项目

如一模式识别更新提示

matlab在图像处理方面的应用有更新

如一模式识别 友情链接

关于本站作者     chinaw3c     mozilla