16 Star 44 Fork 45

现任明教教主-乾颐堂 / qytang_Python

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
2016.1.20 FTP下载文件.ftplib 567 Bytes
一键复制 编辑 原始数据 按行查看 历史
现任明教教主-乾颐堂 提交于 2016-01-20 10:19 . new file
import os, sys
from getpass import getpass
from ftplib import FTP
nonpassive = False
filename = 'ftp.txt'
dirname = '.'
sitename = '172.16.1.2'
userinfo = ('collinsctk', getpass('Pswd?'))
if len(sys.argv) > 1: filename = sys.argv[1]
print('Connecting...')
connection = FTP(sitename)
connection.login(*userinfo)
connection.cwd(dirname)
if nonpassive:
connection.set_pasv(False)
print('Downloading...')
localfile = open(filename, 'wb')
connection.retrbinary('RETR ' + filename, localfile.write, 1024)
connection.quit()
localfile.close()
Python
1
https://gitee.com/qytang/qytang_Python.git
git@gitee.com:qytang/qytang_Python.git
qytang
qytang_Python
qytang_Python
master

搜索帮助