【Python】连接FTP服务器

使用python登录到ftp服务器:

#!/usr/local/bin/python3
#coding=utf-8
import ftplib

host="xxx.xxx.xxx.xxx" #ip或域名
username="xxx"
password="xxx"

ftpServer=ftplib.FTP(host)
ftpServer.encoding = "utf-8"

ftpServer.login(username,password)
ftpServer.dir() #列出目录

print("登录成功")
原创文章 56 获赞 44 访问量 9万+

猜你喜欢

转载自blog.csdn.net/devnn/article/details/93220117