香港云主机最佳企业级服务商!

ADSL拨号VPS包含了中国大陆(联通,移动,电信,)

中国香港,国外拨号VPS。

当前位置:云主机 > python >

电信ADSL拨号VPS
联通ADSL拨号VPS
移动ADSL拨号VPS

python网络编程之读取网站根目录实例


时间:2021-11-09 10:24 作者:admin610456


本文实例讲述了python/' target='_blank'>python网络编程之读取网站根目录的方法,分享给大家供大家参考。

具体实现方法如下:

import socket, sys  port = 70 host = "quux.org" filename = "//"  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程序设计有所帮助

(责任编辑:admin)






帮助中心
会员注册
找回密码
新闻中心
快捷通道
域名登录面板
虚机登录面板
云主机登录面板
关于我们
关于我们
联系我们
联系方式

售前咨询:17830004266(重庆移动)

企业QQ:383546523

《中华人民共和国工业和信息化部》 编号:ICP备00012341号

Copyright © 2002 -2018 香港云主机 版权所有
声明:香港云主机品牌标志、品牌吉祥物均已注册商标,版权所有,窃用必究

云官方微信

在线客服

  • 企业QQ: 点击这里给我发消息
  • 技术支持:383546523

  • 公司总台电话:17830004266(重庆移动)
  • 售前咨询热线:17830004266(重庆移动)