我通过soap和wsdl访问这些数据,最后连接返回数据。但是,我正试图正确访问fv数组中的值。循环访问它们的正确方法是什么?
stdClass Object
(
[DataFormItem] => stdClass Object
(
[Values] => stdClass Object
(
[fv] => Array
(
[0] => stdClass Object
(
[Value] => xxxx
[ID] => FIRSTNAME
)
[1] => stdClass Object
(
[Value] => xxxx
[ID] => LASTNAME
)
[2] => stdClass Object
(
[Value] => xxxx
[ID] => BIRTHDATE
)
[3] => stdClass Object
(
[Value] => xxxx
[ID] => DEGREEYEAR
)
[4] => stdClass Object
(
[Value] => xxxx
[ID] => ADDRESSBLOCK
)
[5] => stdClass Object
(
[Value] => xxxx
[ID] => CITY
)
)
)
)
答案 0 :(得分:3)
试试这个:
from collections import defaultdict
results = defaultdict(list)
for k, v in zip(x, x[1:]):
results[k].append(v)