神剑山庄资源网 Design By www.hcban.com
例一:使用httplib访问某个url然后获取返回的内容:

Python httplib,smtplib使用方法import httplib
Python httplib,smtplib使用方法
Python httplib,smtplib使用方法conn=httplib.HTTPConnection("www.cnblogs.com")
Python httplib,smtplib使用方法conn.request("GET", "/coderzh/archive/2008/05/13/1194445.html")
Python httplib,smtplib使用方法r=conn.getresponse()
Python httplib,smtplib使用方法print r.read() #获取所有内容
例二:使用smtplib发送邮件

Python httplib,smtplib使用方法import smtplib
Python httplib,smtplib使用方法smtpServer = 'smtp.xxx.com'
Python httplib,smtplib使用方法fromaddr = 'foo@xxx.com'
Python httplib,smtplib使用方法toaddrs = 'your@xxx.com'
Python httplib,smtplib使用方法msg = 'Subject: xxxxxxxxx'
Python httplib,smtplib使用方法server = smtplib.SMTP(smtpServer)
Python httplib,smtplib使用方法server.sendmail(fromaddr, toaddrs, msg)
Python httplib,smtplib使用方法server.quit( )
标签:
Python,httplib,smtplib

神剑山庄资源网 Design By www.hcban.com
神剑山庄资源网 免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
神剑山庄资源网 Design By www.hcban.com

评论“Python httplib,smtplib使用方法”

暂无Python httplib,smtplib使用方法的评论...