# 删除lot_data.db 保留三天的数据 import datetime from db.repository import delete_kb_detail_by_time def delete_data_3_days_ago(): try: # 计算3天前的日期并转化为数据库格式 end_time = int((datetime.datetime.now() - datetime.timedelta(days=3)).timestamp()) d = delete_kb_detail_by_time(end_time) except Exception as e: pass if __name__ == '__main__': delete_data_3_days_ago()