摘要:#!/bin/python#coding=utf-8#导入smtplib和MIMETextimport smtplibfrom email.mime.text import MIMEText##############要发给谁mailto_list=["xxxx@gmail.com"]######################设置服务器,用户名、口令以及邮箱的后缀mail_host="smtp.163.com"mail_user="xxxx@163.com"mail_pass="xxxxx"mail_postfi
阅读全文
摘要:#!/bin/python#coding=utf-8from datetime import datetimefrom datetime import timedelta###################格式化输出 Begin#######################date>>stringnow = datetime.now()print now.strftime('%Y-%m-%d %H:%M:%S')#string>>datestr_date='2013-11-02 16:26:23'd=datetime.strptime(
阅读全文
摘要:简单的通讯录实现,A byte of Python的例子#!/bin/python#coding=utf8import ostry: import cPickle as pexcept: import pickle as pclass Person: def __init__(self,name,mobile='',email='',address=''): self.name = name self.mobile = mobile self.email = email self.address = address def modifyInfo(
阅读全文
摘要:一个简单的例子,A byte of Python的例子,利用系统自带的命令创建某些文件的备份,放入指定的目录中import osimport timesource = ['/home/dat/python/test1','/home/dat/python/test2']target_dir = '/home/dat/python/'today = target_dir+time.strftime('%Y%m%d')now = time.strftime('%H%M%S')comment = raw_input(
阅读全文