class Account(): def __init__(self, account_name, account_type, account_cost, return_amount=0): self.account_name = account_name # 账户名 self.account_type = account_type # 账户类型 self.account_cost = account_cost # 月结费用 self.return_amount = return_amount # 返还金额
accounts = [Account("张三", "年费用户", 450.00, 50),
Account("李四", "月结用户", 100.00),
Account("杨不悔", "月结用户", 190.00, 25),
Account("任我行", "月结用户", 70.00, 10),
Account("凌未风", "年费用户", 400.00, 40)]
accounts_iterator = iter(accounts) (next(accounts_iterator)).account_name
class AccountIterator():
def __init__(self, accounts):
self.accounts = accounts # 账户集合
self.index = 0
def __iter__(self):
return self
def __next__(self):
if self.index >= len(self.accounts):
raise StopIteration("到头了...")
else:
self.index += 1
return self.accounts[self.index-1]
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2026 源码网商城 (www.ymwmall.com) 版权所有