手机
当前位置:查字典教程网 >脚本专栏 >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中的CURL PycURL使用例子

python 实现堆排序算法代码

Python的print用法示例

python中使用sys模板和logging模块获取行号和函数名的方法

python中使用enumerate函数遍历元素实例

python中getattr函数使用方法 getattr实现工厂模式

Python 条件判断的缩写方法

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

Python和php通信乱码问题解决方法

Python数组条件过滤filter函数使用示例

精品推荐
分类导航