代码要最简化
import datetime
import MySQLdb
import sys
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
__author__ = 'ninghao'
def send_mail():
me = "[email protected]"
you = "[email protected]"
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"
一直top
#!/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)