class Account: def __init__(self, filepath): self.filepath = filepath with open(filepath, 'r') as file: self.balance=int(file.read()) def withdraw(self, amount): self.balance = self.balance - amount def deposit(self, amount): self.balance = self.balance + amount def __del__(self): print("self.filepath wynosi:", self.filepath) print("self.balance wynosi wynosi:", self.balance, "i ma typ:", type(self.balance)) with open(self.filepath, 'w') as file: file.write(str(self.balance)) account = Account("balance.txt") print("na koncie jest:", account.balance) account.withdraw(100) print("na koncie jest:", account.balance) del(account) # account.commit()