想写个定时删除文件的,提示module 'schedule' has no attribute 'every'

import os
import shutil
import schedule
import time
path = 'C:/Users/Administrator/Documents/WeChat Files' # 文件路径
ls = os.listdir(path)
print(ls)
delList = []
def del_file(delDir):
delList = os.listdir(delDir)
for f in delList:
filePath = os.path.join(delDir, f)
if os.path.isfile(filePath):
os.remove(filePath)
print
filePath + " was removed!"
elif os.path.isdir(filePath):
shutil.rmtree(filePath, True)
print
"Directory: " + filePath + " was removed!"
def job():
del_file(path)
print('清理完毕!')
schedule.every().day.at("10:30").do(job)
while True:
schedule.run_pending()
time.sleep(1)度了一下,说是文件名用了schedule ,可是我没。。。
相关推荐
求解报错:AttributeError:module ‘os’ has no attribute ‘exit’
"在Python编程过程中遇到一个错误,具体表现为尝试使用`os.exit()`方法时抛出`AttributeError`,提示`module 'os' has no attribute 'exit
关于json_to_dataset时出现 module ‘labelme.utils’ has no attribute ‘draw_label’的解决
在处理图像标注数据时,尤其是在使用LabelMe工具生成`json_to_dataset`函数的过程中,可能会遇到"module 'labelme.utils' has no attribute 'd
解决运行django程序出错问题 strobject has no attribute_meta
如下所示:报错原因是传入的是类对象,可你传进的参数是字符串,找到传参的位置改过来即可补充知识:’dict’ object has no attribute ‘has_key’ 解决办法最近开始学习Py
在Python中使用moviepy进行视频剪辑时输出文件报错 ‘NoneType’ object has no attribute ‘stdout’问题
"在Python中使用moviepy进行视频剪辑时遇到‘NoneType’ object has no attribute ‘stdout’的问题,这通常是由moviepy库的特定版本中的bug导致
java删除指定文件夹下文件
Files.walkFileTree(path, new FileDeleter()); } catch (IOException e) { e.printStackTrace(); }}```如果你想删除指定类型的文件


