Python http服务器,用于从Windows PC上的所有位置下载文件

2024-05-20 23:46:00 发布

您现在位置:Python中文网/ 问答频道 /正文

我创建了一个脚本,通过从特定目录运行“python-msimplehttpserver8000”,从我的Windows PC下载文件。在

这是我的剧本:

import os, socket
myip = socket.gethostbyname(socket.gethostname())
print "Open > " + myip + ":8000 < on your browser to access the File Server"
os.chdir("G:\\fileserver")
os.system("python -m SimpleHTTPServer 8000")

问题是我想包括我电脑上的所有文件,但这将只显示G:\fileserver中的文件。在

在Linux上,我会简单地包含“/”,但我不知道在Windows中应该包括什么。在


Tags: 文件import目录脚本oswindowssocketprint