手机
当前位置:查字典教程网 >脚本专栏 >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使用方法】相关文章:

python定时器使用示例分享

Python 条件判断的缩写方法

python爬取网站数据保存使用的方法

Python 解析XML文件

Python调用C/C++动态链接库的方法详解

python中的sort方法使用详解

Python中使用 Selenium 实现网页截图实例

python zip文件 压缩

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

Python splitlines使用技巧

精品推荐
分类导航