查看网页服务器搭建方式(Python3)
生活随笔
收集整理的這篇文章主要介紹了
查看网页服务器搭建方式(Python3)
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
通過方式
通過urllib.request.urlopen()返回的response對(duì)象中的getheader(‘Server’)這個(gè)函數(shù)進(jìn)行實(shí)現(xiàn)。
實(shí)例一
>>> import urllib >>> import urllib.request >>> response = urllib.request.urlopen('http://www.python.org') >>> print(response.getheader('Server')) nginx實(shí)例二
>>> import urllib >>> import urllib.request >>>> response = urllib.request.urlopen('http://www.baidu.com') >>> print(response.getheader('Server')) BWS/1.1總結(jié)
以上是生活随笔為你收集整理的查看网页服务器搭建方式(Python3)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 迪杰斯特拉算法(Dijkstra)证明
- 下一篇: 设置timeout限制在爬虫中的运用