如何在Jython(或Python)如何将文件下载到特定的路径在服务器:Python的
上下载通过HTTP文件到本地文件夹我的服务器上的下面的代码可能工作
os.chdir("/path/to/change/to")
from urllib2 import urlopen
f = urlopen("http://some.server/some/directory/some.file")
但为此我的当前工作目录已更改。我想要在当前工作目录中并将文件下载到我的服务器上的任何给定路径。
任何帮助?
@whokares:使用'shutil.copy()'?你应该'输入shutil',但'urllib.urlretrieve()'为你做所有的事情:) – mouad 2011-06-16 14:27:01
是的,它得到了.. thnx btw – crackerplace 2011-06-16 14:30:00
@whokares:很高兴它有帮助:) – mouad 2011-06-16 14:31:30