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

首頁 > 編程 > Python > 正文

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

2019-11-25 18:10:06
字體:
來源:轉載
供稿:網友

本文實例講述了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程序設計有所幫助

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 康马县| 栾城县| 大悟县| 兴安县| 林口县| 南投县| 泗水县| 资兴市| 镇巴县| 铜鼓县| 永登县| 兴安盟| 抚远县| 行唐县| 武山县| 玛纳斯县| 黄山市| 张家港市| 清水县| 汝南县| 湖口县| 东方市| 清远市| 阿克苏市| 巢湖市| 溧水县| 宝兴县| 富裕县| 闽侯县| 永丰县| 重庆市| 佛坪县| 中江县| 资兴市| 德清县| 银川市| 和平区| 九寨沟县| 乐平市| 宁南县| 南丰县|