zoukankan      html  css  js  c++  java
  • python连接ftp服务

    ftp服务以argo中国中心为例(ftp://ftp.argo.org.cn/pub/)

    python调用ftplib库

    下述代码输出打印 ftp://ftp.argo.org.cn/pub/下的子文件名

    #!/usr/bin/env python
    # _*_ coding:utf-8 _*_
    # @Time : 2021/11/6 16:29
    # @Author : Jiang QH
    # @FileName: test.py
    # @Software: PyCharm

    from ftplib import FTP import os import time from datetime import datetime from threading import Timer remote_path = "./pub" # 远端目录 # 连接FTP def ftp_connect(): ftp = FTP('ftp.argo.org.cn') ftp.set_debuglevel(2)#调试信息,不想要可用0 ftp.login()#匿名登录为空即可 ftp.cwd(remote_path)#cd至目标文件夹('ftp.argo.org.cn'+remote_path ) remote_file_names = ftp.nlst() # 获取文件列表 ftp.quit() for remote_file_name in remote_file_names: print(remote_file_name) ftp_connect()

      

    JQH的笔记仓库与学习记录。。。。。。
  • 相关阅读:
    为服务部署 Jekins的使用
    spring cloud
    docker
    WebSocket
    idea
    maven
    SQL四种语言(DDL、 DML、 DCL、 TCL)
    十大经典排序
    AVL树的旋转图解和简单实现
    多个线程交替打印
  • 原文地址:https://www.cnblogs.com/jiang2020/p/15517497.html
Copyright © 2011-2022 走看看