手机
当前位置:查字典教程网 >脚本专栏 >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中的sort方法使用详解

用Python脚本生成Android SALT扰码的方法

让python json encode datetime类型

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

Python strip lstrip rstrip使用方法

Python 除法小技巧

python脚本实现查找webshell的方法

精品推荐
分类导航