jcvi.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:tredparse 作者: humanlongevity 项目源码 文件源码
def ls_ftp(dir):
    from urlparse import urlparse
    from ftplib import FTP, error_perm
    o = urlparse(dir)

    ftp = FTP(o.netloc)
    ftp.login()
    ftp.cwd(o.path)

    files = []
    try:
        files = ftp.nlst()
    except error_perm, resp:
        if str(resp) == "550 No files found":
            print "no files in this directory"
        else:
            raise
    return files
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号