循环一个字典时报错:
数据:{'O_DATA': [{'ACCOUNT': 'A20001002', 'ZACTOSP': Decimal('21792635.96'), 'ZBUDGET': Decimal('290271.50'), 'ZACTUAL': Decimal('4878563.10')}]}
代码:
代码语言:javascript复制 for key, value in response.data['O_DATA'][0]:
print(key, value)
循环字典的时候忘了items()
代码语言:javascript复制 for key, value in response.data['O_DATA'][0].items():
print(key, value)
调整后,输出: