Python-使用smtplib和email模块发送邮件

摘要:SMTP (Simple Mail Transfer Protocol)  邮件传送代理 (Mail Transfer Agent,MTA) 程序使用SMTP协议来发送电邮到接收者的邮件服务器。SMTP协议只能用来发送邮件,不能用来接收邮件。大多数的邮件发送服务器 (Outgoing Mail Server) 都是使用SMTP协议。SMTP协议的默认TCP端口号是25。  SMTP协议的一个重要特点是它能够接力传送邮件。它工作在两种情况下:一是电子邮件从客户

 Python-模块- 发送邮件实例

摘要:文件形式的邮件 #!/usr/bin/envpython3  #coding: utf-8  import smtplib  from email.mime.textimport MIMEText  from email.headerimport Header    sender = '***'  receiver = '***'  subject = 'python emailtest'  smtpserver ='smtp.163.com'  username = '***'  password = '***'   msg = MIME

 Python-模块-time

摘要:我们先导入必须用到的一个module>>> import time设置一个时间的格式,下面会用到>>>ISOTIMEFORMAT=’%Y-%m-%d %X’看一下当前的时间,和其他很多语言相似这是从epoch(1970 年 1 月 1 日 00:00:00)开始到当前的秒数。>>> time.time()1180759620.859上面的看不懂,换个格式来看看>>> time.localtime()(2007, 6, 2, 12, 47, 7, 5, 153, 0)l

 Python-模块-re模块

摘要: 另附传送门两枚:http://www.cnblogs.com/PythonHome/archive/2011/11/19/2255459.htmlhttp://wiki.ubuntu.org.cn/Python%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F%E6%93%8D%E4%BD%9C%E6%8C%87%E5%8D%97正则表达式(可以称为REs,regex,regex pattens)是一个小巧的,高度专业化的编程语言,它内嵌于python开发语言中,可通过re模块使用。正则表达式的pattern可以被

 Python-模块-platform

摘要:'''    python中,platform模块给我们提供了很多方法去获取操作系统的信息    如:        import platform        platform.platform()   #获取操作系统名称及版本号,'Windows-7-6.1.7601-SP1'        platform.version

 Python-模块-os

摘要:一、os模块概述 Python os模块包含普遍的操作系统功能。如果你希望你的程序能够与平台无关的话,这个模块是尤为重要的。(一语中的) 二、常用方法 1、os.name 输出字符串指示正在使用的平台。如果是window 则用'nt'表示,对于Linux/Unix用户,它是'posix'。 2、os.getcwd() 函数得到当前工作目录,即当前Python脚本工作的目录路径。 3、os.l

 Python-模块-filecmp

摘要:filecmp模块用于比较文件及文件夹的内容,它是一个轻量级的工具,使用非常简单。python标准库还提供了difflib模块用于比较文件的内容。关于difflib模块,且听下回分解。     filecmp定义了两个函数,用于方便地比较文件与文件夹: filecmp.cmp(f1, f2[, shallow]):     比较两个文件的内容是否匹配。参数f1, f2指定要比较的文件

 Python-模块-dnspython

摘要:安装:    # www.dnspython.org/kits/1.12.0/dnspython-1.12.0.tar.gz    # tar -zxvf dnspython-1.12.0.tar.gz      # cd dnspython-1.12.0      # python setup.py install qyery 引擎定义:    query(self,qname,rdtype=1,rdclass=1,tcp=False,source=None,raise_on_no_answer=True,

 Python-模块-IPy

摘要:模块安装:进去linux主机 安装IPy模块cd /usr/local/src/pythongit clone https://github.com/haypo/python-ipy.gitcd python-ipypython setup.py installfrom IPy import IPip=IP('192.168.1.0/24')print ip.len()    #查看指定IP地址的个数for x in ip:    #返回所有的IP地址    print (x)eg;256192.168.1.0192.168.1.1192.168

 Python-模块-psutil

摘要:进去linux主机 安装IPy模块cd /usr/local/src/pythongit clone https://github.com/haypo/python-ipy.gitcd python-ipypython setup.py install安装psutil模块,可以通过python获取系统的cpu,磁盘,内存,进程,网络等相关信息下载地址https://pypi.python.org/pypi/psutil/cd /usr/local/src/pythonwget https://pypi.python.org/packages/source/p/psutil/psutil-2.1.3.tar.

 Python-外部模块的安装

摘要:方法一:    下载外部模块源文件,解压后放到指定的目录下:    将安装文件复制到:/usr/lib/python2.7/site-packages 这个目录下    或使用: python setup.py install 来安装到上面的目录下方法二:    setuptools:直接根据模块名称来自动下载安装,不需要自己再去寻找模块的安装文件    yum insta

 Python-模块安装

摘要:Python模块常用的几种安装方式Python模块安装方法一、方法1:单文件模块直接把文件拷贝到 $python_dir/Lib二、方法2:多文件模块,带setup.py下载模块包,进行解压,进入模块文件夹,执行:python setup.py install三、方法3:easy_install 方式方法一:yum installpython-setuptools 方法二:先下载ez_setup.py,运行python ez_setup 进行easy_install工具的安装,之后就可

 Python入门教程

摘要:重要说明这不是给编程新手准备的教程,如果您入行编程不久,或者还没有使用过1到2门编程语言,请移步!这是有一定编程经验的人准备的.最好是熟知Java或C,懂得命令行,Shell等.总之,这是面向老鸟的,让老鸟快速上手Python教程.为什么总结这样的一个教程我虽不是老鸟,但已熟悉Java,C/C++, Shell和Perl,且对常见的数据结构和算法等都了解.最近因项目需要,要做一个小工具,评估后感觉用Pyt

 FastDFS安装配置-client.conf

摘要:# is this config file disabled# false for enabled# true for disableddisabled=false# bind an address of this host# empty for bind all addresses of this hostbind_addr=# the tracker server portport=22122# connect timeout in seconds# default value is 30sconnect_timeout=30# network timeout in seconds# default value is 30snetwork_timeout=60# the base pat

 FastDFS安装配置-storage.conf

摘要:# is this config file disabled# false for enabled# true for disableddisabled=false# the name of the group this storage server belongs to## comment or remove this item for fetching from tracker server,# in this case, use_storage_id must set to true in tracker.conf,# and storage_ids.conf must be configed correctly.group_name=group1# bind an address o

 FastDFS安装配置-mod_fastdfs.conf

摘要:# connect timeout in seconds# default value is 30sconnect_timeout=2# network recv and send timeout in seconds# default value is 30snetwork_timeout=30# the base path to store log filesbase_path=/tmp# if load FastDFS parameters from tracker server# since V1.12# default value is falseload_fdfs_parameters_from_tracker=true# storage sync file max delay

 FastDFS安装配置

摘要:http://github.com/happyfish100源码文件 所有的安装都是一个安装包,只是启动的服务不同而已 服务端安装配置:从github上下载lib库安装:https://github.com/happyfish100/libfastcommon.git安装依赖包:cd /usr/local/src/fastdfs# unzip libfastcommon-master.zip #./make.sh#./make.sh install 从gibhub上下载 安装包:(每台安装都一样)[root@node120

 Docker数据管理

摘要:数据卷: 在Docker容器内将里面的数据直接写到硬盘上-v /data[root@node121 data]# docker run -it --namevolume-test1 -h centos -v /docker/data centos        -i :让终端保持打开的状态        -t:启动一个tty        -h:指定主机名   &nb

 Docker FAQ FATA[0000] Error starting daemon: Error initializing network controller: Error creating d

摘要:FATA[0000] Error starting daemon: Error initializingnetwork controller: Error creating default "bridge" network: packagenot installed  解决方法: docker -d –bip=172.17.42.1/16 指定一个docker网段就可以成功启动了   网上有好多类似的解决方法,不过好麻烦,这里主要说下最方便的解决方法 先su到root 找一下doc

 Docker FAQ FATA[0000] Error mounting devices cgroup: mountpoint for devices not found

摘要:FATA[0000] Error mounting devices cgroup: mountpoint fordevices not found这个错误为cgroup在宿主机上没有挂载。我们编辑挂载上去            vi /etc/fstab#在结尾添加none       /sys/fs/cgroup        cgroup    &
分页:« 48 49 50 51 52 53 54 55 56 57 »
Powered by AKCMS