导航
  • 报考
  • 备考
  • 政策

报考

备考

复习资料

政策

行业动态

python互联网协议是什么?掌握这个才算是会用python

环球青藤·2020-07-13 15:37:43浏览45 收藏9

请输入下面的图形验证码

提交验证

预约成功

我知道了
摘要 开发高质量软件的一种方法是在开发期间为每个功能编写测试,并在开发期间经常运行它们。python判断值的类型的方法是什么,那么python互联网协议是什么?掌握这个才算是会用python,所以你知道python互联网协议是什么?掌握这个才算是会用python。

python互联网协议是什么?以下就是互联网访问协议的相关内容:

有许多模块可用于互联网访问协议和处理互联网协议。其中两个最简单的 urllib.request 用于从URL检索数据,以及 smtplib 用于发送邮件:

>>>>>> from urllib.request import urlopen

>>> with urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl') as response:

... for line in response:

... line = line.decode('utf-8') # Decoding the binary data to text.

... if 'EST' in line or 'EDT' in line: # look for Eastern Time

... print(line)

Nov. 25, 09:43:32 PM EST

>>> import smtplib

>>> server = smtplib.SMTP('localhost')

>>> server.sendmail('soothsayer@example.org', 'jcaesar@example.org',

... """To: jcaesar@example.org

... From: soothsayer@example.org

...

... Beware the Ides of March.

... """)

>>> server.quit()

python互联网协议是什么?(请注意,第二个示例需要在localhost上运行的邮件服务器。)

以上就是《python互联网协议是什么?掌握这个才算是会用python》的全部内容,Python是一种动态解释的、强类型定义语言:编写它时不需要定义变量类型,运行时变量类型被强制固定,如果你想知道更多的python的相关方法,可以点击下方资料下载链接

展开剩余
资料下载
历年真题
精选课程
老师直播

注册电脑版

版权所有©环球青藤All Rights Reserved