Python httplib,smtplib使用方法

时间:2021-12-23 04:34:29 

例一:使用httplib访问某个url然后获取返回的内容:

Python httplib,smtplib使用方法import httplib
Python httplib,smtplib使用方法
Python httplib,smtplib使用方法conn=httplib.HTTPConnection("www.cnblogs.com")
Python httplib,smtplib使用方法conn.request("GET", "/coderzh/archive/2008/05/13/1194445.html")
Python httplib,smtplib使用方法r=conn.getresponse()
Python httplib,smtplib使用方法print r.read() #获取所有内容


例二:使用smtplib发送邮件

Python httplib,smtplib使用方法import smtplib
Python httplib,smtplib使用方法smtpServer = 'smtp.xxx.com'
Python httplib,smtplib使用方法fromaddr = 'foo@xxx.com'
Python httplib,smtplib使用方法toaddrs = 'your@xxx.com'
Python httplib,smtplib使用方法msg = 'Subject: xxxxxxxxx'
Python httplib,smtplib使用方法server = smtplib.SMTP(smtpServer)
Python httplib,smtplib使用方法server.sendmail(fromaddr, toaddrs, msg)
Python httplib,smtplib使用方法server.quit( )

标签:Python,httplib,smtplib
0
投稿

猜你喜欢

  • 在Python中通过getattr获取对象引用的方法

    2023-08-24 23:32:33
  • 关于JS中的事件--Event对象

    2008-03-16 14:22:00
  • python样条插值的实现代码

    2022-05-11 16:04:05
  • 通过Python把学姐照片做成拼图游戏

    2022-03-24 17:21:01
  • Python的索引与切片原来该这样理解

    2023-11-21 16:17:51
  • python计算日期之间的放假日期

    2021-08-14 00:02:42
  • 使用Python绘制图表大全总结

    2022-08-09 20:35:27
  • python调用cmd命令行制作刷博器

    2023-07-26 15:18:35
  • ASP中Utf-8与Gb2312编码转换乱码问题的解决方法 页面编码声明

    2012-11-30 20:45:55
  • python人工智能tensorflow常见损失函数LOSS汇总

    2023-11-22 18:12:48
  • 对Python 中矩阵或者数组相减的法则详解

    2024-01-02 01:29:17
  • Div的浮动+循环(描述的不清楚,请看图)

    2008-09-22 20:21:00
  • Python爬取新型冠状病毒“谣言”新闻进行数据分析

    2021-06-14 04:47:33
  • 用python写个博客迁移工具

    2023-06-09 05:13:14
  • IE6图片加载的一个BUG解决方法

    2023-09-16 03:20:10
  • Python语言描述机器学习之Logistic回归算法

    2023-08-31 01:14:35
  • Python3实现的爬虫爬取数据并存入mysql数据库操作示例

    2022-11-06 15:18:59
  • ASP--IP字段截取

    2009-05-26 15:47:00
  • python中终止协程和异常处理方式

    2022-10-18 05:44:41
  • 详解设计模式中的工厂方法模式在Python程序中的运用

    2022-11-14 01:06:58
  • asp之家 网络编程 m.aspxhome.com