Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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ÖÐeval, exec, execfile,ºÍcompile


eval(str [,globals [,locals ]])º¯Êý½«×Ö·û´®strµ±³ÉÓÐЧPython±í´ïʽÀ´ÇóÖµ£¬²¢·µ»Ø¼ÆËã½á¹û¡£
ͬÑùµØ, execÓï¾ä½«×Ö·û´®strµ±³ÉÓÐЧPython´úÂëÀ´Ö´ÐÐ.Ìṩ¸øexecµÄ´úÂëµÄÃû³Æ¿Õ¼äºÍexecÓï¾äµÄÃû³Æ¿Õ¼äÏàͬ.
×îºó£¬execfile(filename [,globals [,locals ]])º¯Êý¿ÉÒÔÓÃÀ´Ö´ÐÐÒ»¸öÎļþ,¿´ÏÂÃæµÄÀý×Ó:
>>> ev ......

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();& ......

python±Ê¼Ç——¹îÒìBUG£¿

×î½üÓÖÖØÐÂ×°ÉÏÁËwindows 7¸Ð¾õ»¹ÊÇÄÇÑù£¬Ö÷ÒªÊÇÏëÓÃM8SDKдЩ³ÌÐò¡£Ò²ÏëÔÚwindowsÉÏÍæÍ棬һֱ¶¼¾õµÃÓÃCдһЩ³£ÓõĶ«¶«ºÜ¸´ÔÓ£¬Ö»ÓнèÖúÓÚ½âÊÍÐÔÓïÑÔÁË£¬ÔÚpython, ruby¼äÑ¡Ôñ£¬×îÖÕÓÃPython¡£
pythonµÄÓï·¨·Ç³£¼òµ¥£¬¶ÔÓÚÒ»¸öѧ¹ý±à³ÌµÄÈË¿ÉÄÜÒ»ÉÏÎç¾Í²î²»¶àÁË£¬²»¹ýpythonµÄÇ¿´óÖ®´¦ÔÚÓÚËüÓÐN¶àµÄ¿â¿ÉÒÔ·½±ãÎÒÃÇ´¦ÀíÎ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ