1 Star 0 Fork 45

chundonglinlin/qytang_Python

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
2016.02.10 ftp putfile 454 Bytes
一键复制 编辑 原始数据 按行查看 历史
现任明教教主-乾颐堂 提交于 2016-02-10 10:23 . new file
import ftplib
def putfile(file, site, dir, user=(), *, verbose = True):
if verbose:print('Uploading', file)
local = open(file, 'rb')
remote = ftplib.FTP(site)
remote.login(*user)
remote.cwd(dir)
remote.storbinary('STOR ' + file, local, 1024)
remote.quit()
local.close()
if verbose: print('Upload done.')
if __name__ == '__main__':
site = '172.17.100.205'
dir = '.'
putfile('ftp.py', site, dir, user=('labtest', 'xxxx'))
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/chundonglinlin/qytang_Python.git
git@gitee.com:chundonglinlin/qytang_Python.git
chundonglinlin
qytang_Python
qytang_Python
master

搜索帮助