查看网页服务器搭建方式(Python3)
生活随笔
收集整理的這篇文章主要介紹了
查看网页服务器搭建方式(Python3)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
通過方式
通過urllib.request.urlopen()返回的response對象中的getheader(‘Server’)這個函數進行實現。
實例一
>>> import urllib >>> import urllib.request >>> response = urllib.request.urlopen('http://www.python.org') >>> print(response.getheader('Server')) nginx實例二
>>> import urllib >>> import urllib.request >>>> response = urllib.request.urlopen('http://www.baidu.com') >>> print(response.getheader('Server')) BWS/1.1總結
以上是生活随笔為你收集整理的查看网页服务器搭建方式(Python3)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 迪杰斯特拉算法(Dijkstra)证明
- 下一篇: 【requests】Python轻松爬取