我正在尝试使用 Spyder (python 3.8) 删除 ftp 文件,但其中一个导入“ ftputil ”不起作用。错误代码看起来像
导入 ftputil ModuleNotFoundError:没有名为“ftputil”的模块
代码
#! /usr/bin/python
import time
import ftputil
host = ftputil.FTPHost('host', 'username', 'password')
mypath = 'ftp_dir'
now = time.time()
host.chdir(mypath)
names = host.listdir(host.curdir)
for name in names:
if host.path.getmtime(name) < (now - (3600)):
if host.path.isfile(name):
host.remove(name)
host.close()
如果它不起作用,我们可以使用另一个导入。