{
wcDownloadFile("的URL地址", "保存在服务器上的路径");
}
例:下载、上传文件
# coding: utf-8from ftplib import FTP
import time
import tarfile
import os
# !/usr/bin/python
# -- coding: utf-8 --
from ftplib import FTP
def ftpconnect(host, username, password):
ftp = FTP()
# ftpset_debuglevel(2)
ftpconnect(host, 21)
ftplogin(username, password)
return ftp
#从ftp下载文件
def downloadfile(ftp, remotepath, localpath):
bufsize = 1024
fp = open(localpath, 'wb')
ftpretrbinary('RETR ' + remotepath, fpwrite, bufsize)
ftpset_debuglevel(0)
fpclose()
#从本地上传文件到ftp
def uploadfile(ftp, remotepath, localpath):
bufsize = 1024
fp = open(localpath, 'rb')
ftpstorbinary('STOR ' + remotepath, fp, bufsize)
ftpset_debuglevel(0)
fpclose()
if __name__ == "__main__":
ftp = ftpconnect("113105139xxx", "ftp", "Guest")
downloadfile(ftp, "Faintmp4", "C:/Users/Administrator/Desktop/testmp4")
#调用本地播放器播放下载的视频
ossystem('start "C:\Program Files\Windows Media Player\wmplayerexe" "C:/Users/Administrator/Desktop/testmp4"')
uploadfile(ftp, "C:/Users/Administrator/Desktop/testmp4", "testmp4")
ftpquit()
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)