#!/usr/bin/env python
#
import datetime  
import mysqldb/ target=_blank class=infotextkey>MySQLdb  
import sys  
import smtplib  
from email.mime.multipart import MIMEMultipart  
from email.mime.text import MIMEText  
__author__ = 'ninghao'  
def send_mail():  
        me = "mactonish@163.com"  
        you = "ninghao@sohu-inc.com"  
        msg = MIMEMultipart('alternative')  
        msg['Subject'] = "dean , its what u want "  
        msg['From'] = me  
        msg['To'] = you  
        text = "dean , the thing what u want , I send to you !!!! 2324211232"  
        html = """  
        <html>  
          <head></head>  
          <body>  
            <p>Hi!<br>  
               news , mike is dead !  
            </p>  
          </body>  
        </html>  
        """  
        part1 = MIMEText(text, 'plain')  
        part2 = MIMEText(html, 'html')  
        msg.attach(part1)  
        msg.attach(part2)  
        s = smtplib.SMTP()  
        s.connect('smtp.163.com',25)  
        s.login("mactonish","mima")  
        s.sendmail(me, you, msg.as_string())  
        s.close()  
if __name__ == "__main__":  
    send_mail()  
    print "haha" 
附,以下代码提升进程优先级,没看太懂,懂的朋友分享下你的观点哦。
 
#!/usr/bin/python -u   
import os  
import sys  
import subprocess  
import time
while True:  
        stdout = subprocess.Popen("top -bn 1",shell=True,stdout = subprocess.PIPE)  
        print stdout.communicate()[0]  
        time.sleep(15)