使用Python根据文件目录的HTTP URL下载文件夹中的文件
可能重复的问题:
通过Python遍历网络上的目录并显示其内容(文件和其他目录)
大家好,
如果我在这个地址下有一些代码文件:
我该如何用Python下载这些文件呢?
而且如果这些文件总共占用600M,有没有什么高效的方法来下载呢?
1 个回答
0
你是在用svn作为你的代码仓库吗?它看起来会是这样的:
from subprocess import Popen, PIPE
def svn_co(url):
return run_program('svn', 'co', url)
def run_program(*args):
popen_obj = Popen(args, stderr=PIPE)
_, errors = popen_obj.communicate()
if popen_obj.returncode:
print errors
# This will get all the files in myproject's tagged version
# named tagname into the current directory
svn_co('http://svn.myserver.net/myproject/tags/tagname')