手机
当前位置:查字典教程网 >脚本专栏 >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数组条件过滤filter函数使用示例

python zip文件 压缩

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

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

Python 条件判断的缩写方法

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

Python strip lstrip rstrip使用方法

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

精品推荐
分类导航