I'm building a task manager and I want to use a complete-func that's going to do something with the instantiated and then call del and delete the instantiated class object. Is it possible? I'm trying hard to find a solution.
Tried to use a function from the class, and tried to find articles about this subject, but no success.
from datetime import date class reg_task: def __init__(self, what_to_do, date=date.today(), hour=None, tag=None, project="day to day task", priority=None, remind_time=None): self.what_to_do = what_to_do self.date = date self.hour = hour self.tag = tag self.project = project self.priority = priority self.remind_time = remind_time def __str__(self): return f'task {self.what_to_do}, to-do-date - {self.date}' def tasks_complete(self): with open(r"C:\Users\Avi Fenesh\Desktop\python\tasks_project\archive\archive", "a") as archive: archive.write(f"{str(self)} \n") del self The problem is with tasks_complete(). When I call the function it doesn't delete the instantiated class object.