国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

python網絡編程之讀取網站根目錄實例

2020-02-23 06:02:58
字體:
來源:轉載
供稿:網友

本文實例講述了python網絡編程之讀取網站根目錄的方法,分享給大家供大家參考。

具體實現方法如下:

import socket, sys  port = 70 host = "quux.org" filename = "http://"  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((host, port)) s.sendall(filename+"/r/n")  while(1):   buf = s.recv(2048)   if not buf:     break   sys.stdout.write(buf) 

本文實例運行環境為Python2.7.6

該實例會返回quux.org的根目錄的列表

返回結果如下:

iWelcome to gopher at quux.org! fake (NULL) 0i fake (NULL) 0iThis server has a lot of information of historic interest, fake (NULL) 0ifunny, or just plain entertaining -- all presented in Gopher. fake (NULL) 0iThere are many mirrors here of rare or valuable files with the fake (NULL) 0iaim to preserve them in case their host disappears. PLEASE READ fake (NULL) 0i"About This Server" FOR IMPORTANT NOTES AND LEGAL INFORMATION. fake (NULL) 0i fake (NULL) 00About This Server /About This Server.txt gopher.quux.org 70 +1Archives /Archives gopher.quux.org 70 +1Books /Books gopher.quux.org 70 +1Communication /Communication gopher.quux.org 70 +iThis directory contains the entire text of the book fake (NULL) 0i"We the Media: Grassroots Journalism by the People, for the People" fake (NULL) 0iby Dan Gillmor in various formats. fake (NULL) 0i fake (NULL) 0iFeel free to download and enjoy. fake (NULL) 01Computers /Computers gopher.quux.org 70 +1Current Issues and Events (Updated Apr. 23, 2002) /Current gopher.quux.org 70 +1Development Projects /devel gopher.quux.org 70 +0Gopher's 10th Anniversary /3.0.0.txt gopher.quux.org 701Government, Politics, Law, and Conflict /Government gopher.quux.org 70 +0How To Help /How To Help.txt gopher.quux.org 70 +1Humor and Fun /Humor and Fun gopher.quux.org 70 +1Index to Quux.Org /Archives/index gopher.quux.org 701Internet /Internet gopher.quux.org 70 +1Other Gopher Servers /Software/Gopher/servers gopher.quux.org 701People /People gopher.quux.org 70 +1Reference /Reference gopher.quux.org 70 +1Software and Downloads /Software gopher.quux.org 70 +1The Gopher Project /Software/Gopher gopher.quux.org 700What's New /whatsnew.txt gopher.quux.org 70 +

希望本文所述對大家的Python程序設計有所幫助

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 贺州市| 台南市| 德惠市| 棋牌| 海丰县| 都江堰市| 西峡县| 柳江县| 灵山县| 讷河市| 苏尼特右旗| 佛山市| 芜湖市| 安新县| 贵阳市| 鄂伦春自治旗| 疏附县| 苍梧县| 元江| 谷城县| 买车| 新宁县| 泽库县| 逊克县| 双牌县| 荣成市| 江川县| 肃宁县| 武安市| 江都市| 湘潭市| 连城县| 安丘市| 三亚市| 桃江县| 高平市| 修文县| 翁牛特旗| 临邑县| 沁水县| 南康市|