国产探花免费观看_亚洲丰满少妇自慰呻吟_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程序設計有所幫助

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 邯郸市| 灵宝市| 奉贤区| 会同县| 娄底市| 武邑县| 郧西县| 阳高县| 克拉玛依市| 伽师县| 新沂市| 铜陵市| 夹江县| 石门县| 玉林市| 鹤山市| 遂宁市| 安西县| 芦山县| 鹤庆县| 西昌市| 兴业县| 黑山县| 昭平县| 和政县| 库伦旗| 大荔县| 西畴县| 隆德县| 昌黎县| 齐齐哈尔市| 石棉县| 广东省| 兰西县| 孟村| 江安县| 元朗区| 莱州市| 普安县| 若羌县| 新竹市|