[Fedora-suds-list] Return type challenge

Matt C mcauthorn at gmail.com
Tue Nov 17 18:41:05 UTC 2009


All - I've got some return types coming back from a service that get
fairly deep (this is a smaller example):

(Array){
   item[] =
      (item){
         item[] =
            (item){
               address[] =
                  "1.2.3.4",
               port[] =
                  "80",
            },
      },
      (item){
         item[] =
            (item){
               address[] =
                  "10.20.20.10",
               port[] =
                  "80",
            },
            (item){
               address[] =
                  "10.20.20.11",
               port[] =
                  "80",
            },
            (item){
               address[] =
                  "10.20.20.12",
               port[] =
                  "80",
            },
      },
 }

Do any of you know an easy way to "flatten" this structure into normal
python types? Ideally I'd like to convert it to:

[ [{'address':'1.2.3.4', 'port':80}], [{'address': '10.20.20.10',
'port': 80}, {'address': '10.20.20.11', 'port': 80}, {'address':
'10.20.20.12', 'port':80}] ]

I figured I'd ask the group before I went and reinvented a wheel.

-Matt




More information about the suds mailing list