我如何创建一个保存和更新事务的功能,使得当我关闭程序并再次运行它时,帐户将显示程序结束前进行的最后一笔事务。
Account(object):
def __init__(self):
self.balance = 0
def deposit(self, amount):
if (amount < 0):
return 'Please deposit an amount greater than 0'
self.balance += amount
print ('Amount deposited {}'.format(amount))
return 'SUCCESS'
def withdraw(self, amount):
if (amount < 0):
return 'Please withdraw an amount greater than 0'
if (amount > self.balance):
return