如何遍历Zeep生成的另一个对象中包含的OrderedDict?

问题描述

我使用Zeep调用SOAP API并返回一个对象,该对象的._ dict _属性列表如下所示:

RestaurantSingleton.Class

我当前的解决方案是使用Zeep Helpers来序列化对象,并使用带有for循环和一堆if语句(请参见下文)的.items()遍历对象,但是肯定有一种更优雅的方法解决这个迭代?

{'__values__': OrderedDict([('Ids',{
    'Id': [
        {
            'Name': 'ID Name One','Value': '00192'
        },{
            'Name': 'ID Name Two','Value': '999996'
        },{
            'Name': 'ID Name 3','Value': 'GF'
        },{
            'Name': 'ID Four','Value': 'AA'
        },{
            'Name': 'ID Name 5','Value': 'Fund Name'
        },{
            'Name': 'Account Code','Value': 'FCOM102'
        },{
            'Name': 'Allocation Code','Value': '00192'
        }
    ]
}),('ID',284),('Amount',Decimal('25.0000')),('Text','Name of my Organization'),('Value','0'),('Instructions','')])}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)