
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)
filePath + " was removed!"
elif os.path.isdir(filePath):
shutil.rmtree(filePath, True)
"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 ,可是我沒。。。
uj5u.com熱心網友回復:
你的目錄下還有一個 schedule.py ,去找那個檔案了uj5u.com熱心網友回復:
全盤搜索了。也沒有這檔案啊只有這個scheduler.py
沒有schedule.py
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/195609.html
上一篇:pyhanlp自定義詞典
