易截截图软件、单文件、免安装、纯绿色、仅160KB

python发邮件的代码

# -*- coding: cp936 -*-
from email.MIMEText import MIMEText
from email.MIMEMultipart import MIMEMultipart
import smtplib
 
#创建一个带附件的实例
msg = MIMEMultipart()
#构造附件
att = MIMEText(open('e:\\test.txt').read(), 'base64', 'gb2312')
att["Content-Type"] = 'application/octet-stream'
#att["Content-Disposition"] = 'attachment; filename="e:\\test.txt"' 以附件形式发送
msg.attach(att)
mailto_list=["wsywfw3@163.com"]
#####################
# 设置服务器,用户名、口令以及邮箱的后缀
mail_host="smtp.163.com"
mail_user="wsywfw3@163.com"
mail_pass="7451920"
mail_postfix="163.com"
######################
def send_mail(to_list,sub,content):
    '''
    to_list:发给谁
    sub:主题
    content:内容
    send_mail("aaa@126.com","sub","content")
    '''
    me=mail_user+"<"+mail_user+"@"+mail_postfix+">"
    msg = MIMEText(content)
    msg = att
    msg['Subject'] = sub
    msg['from'] = me
    msg['To'] = ";".join(to_list)
    try:
        s = smtplib.SMTP()
        s.connect(mail_host)
        s.login(mail_user,mail_pass)
        s.sendmail(me, to_list, msg.as_string())
        s.close()
        return True
    except Exception, e:
        print str(e)
        return False
if __name__ == '__main__':
    if send_mail(mailto_list,"subject","content"):
  


相关文档:

Python中RE模块的应用

      Python 自1.5版本起增加了re 模块,它提供 Perl 风格的正则表达式模式。Python 1.5之前版本则是通过 regex 模块提供 Emecs 风格的模式。Emacs 风格模式可读性稍差些,而且功能也不强,因此编写新代码时尽量不要再使用 regex 模块,当然偶尔你还是可能在老代码里发现其踪影。
  & ......

Python矩阵转置中的二维数组的实际操作方案介绍

如果你对Python矩阵转置的实际应用操作方案的转置不知道如何进行下一步时,你就你需要转置一个二维数组,将Python矩阵转置的行列互换.
这样就可以完成你所需要的应用操作,以下是文章的具体操作。
你需要转置一个二维数组,将行列互换,讨论:你需要确保该数组的行列数都是相同的.比如:
arr
 = [[1, 2,&nbs ......

vc中调用python代码

运行一句python命令
对vc设置路径
include:D:\PYTHON31\INCLUDE
lib:D:\PYTHON31\LIBS
#include "stdafx.h"
#include "python.h"
int main(int argc, char* argv[])
{
 Py_Initialize() ;
 PyRun_SimpleString("print('Hello')");
 //PyRun_SimpleString("print(dir())");
 Py_Finalize();& ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号