通过本文主要向大家介绍了python httplib,python httplib模块,python httplib ua,python httplib https,python httplib下载等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
例一:使用httplib访问某个url然后获取返回的内容:
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->
import httplib

conn=httplib.HTTPConnection("www.cnblogs.com")
conn.request("GET", "/coderzh/archive/2008/05/13/1194445.html")
r=conn.getresponse()
print r.read() #获取所有内容</div>
例二:使用smtplib发送邮件
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->
import smtplib
smtpServer = 'smtp.xxx.com'
fromaddr = 'foo@xxx.com'
toaddrs = 'your@xxx.com'
msg = 'Subject: xxxxxxxxx'
server = smtplib.SMTP(smtpServer)
server.sendmail(fromaddr, toaddrs, msg)
server.quit( )</div>
</div>
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->
import httplib
conn=httplib.HTTPConnection("www.cnblogs.com")
conn.request("GET", "/coderzh/archive/2008/05/13/1194445.html")
r=conn.getresponse()
print r.read() #获取所有内容</div>例二:使用smtplib发送邮件
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->
import smtplib
smtpServer = 'smtp.xxx.com'
fromaddr = 'foo@xxx.com'
toaddrs = 'your@xxx.com'
msg = 'Subject: xxxxxxxxx'
server = smtplib.SMTP(smtpServer)
server.sendmail(fromaddr, toaddrs, msg)
server.quit( )</div>
</div>

