手机
当前位置:查字典教程网 >脚本专栏 >python >Python httplib,smtplib使用方法
Python httplib,smtplib使用方法
摘要:例一:使用httplib访问某个url然后获取返回的内容:importhttplibconn=httplib.HTTPConnection(...

例一:使用httplib访问某个url然后获取返回的内容:

Python httplib,smtplib使用方法1importhttplib

Python httplib,smtplib使用方法1

Python httplib,smtplib使用方法1conn=httplib.HTTPConnection("www.cnblogs.com")

Python httplib,smtplib使用方法1conn.request("GET","/coderzh/archive/2008/05/13/1194445.html")

Python httplib,smtplib使用方法1r=conn.getresponse()

Python httplib,smtplib使用方法1printr.read()#获取所有内容

例二:使用smtplib发送邮件

Python httplib,smtplib使用方法1importsmtplib

Python httplib,smtplib使用方法1smtpServer='smtp.xxx.com'

Python httplib,smtplib使用方法1fromaddr='foo@xxx.com'

Python httplib,smtplib使用方法1toaddrs='your@xxx.com'

Python httplib,smtplib使用方法1msg='Subject:xxxxxxxxx'

Python httplib,smtplib使用方法1server=smtplib.SMTP(smtpServer)

Python httplib,smtplib使用方法1server.sendmail(fromaddr,toaddrs,msg)

Python httplib,smtplib使用方法1server.quit()

【Python httplib,smtplib使用方法】相关文章:

c++生成dll使用python调用dll的方法

Python的print用法示例

python中的sort方法使用详解

python定时器使用示例分享

python基础教程之简单入门说明(变量和控制语言使用方法)

Python学习笔记(二)基础语法

windows下wxPython开发环境安装与配置方法

Python 解析XML文件

linux下安装easy_install的方法

python zip文件 压缩

精品推荐
分类导航