yaml格式处理

class_item
str: SCKA_TopoPort

values
list: [{'SCKA_TopoPort': {'properties': {'portID': {'type': 'unsigned int'}, 'slotID': {'type': 'unsigned int'},
'destPort': {'type': 'SCKA_LinkInPort'}}}, 'SCKA_LinkInNode': {'properties': {'src_Id': {'type': 'unsigned int'},
'srcSlot_Id': {'type': 'unsigned int'}}}, 'SCKA_LinkInPort': {'properties': {'dstSlotId': {'type': 'unsigned int'},
'dstPortId': {'type': 'unsigned int'}, 'speedLevel': {'type': 'unsigned int'}, 'dstNeId': {'type': 'unsigned int'},
'fiberType': {'type': 'unsigned int'}}}}]

tom = values[0]

dict: {'SCKA_TopoPort': {'properties': {'portID': {'type': 'unsigned int'}, 'slotID': {'type': 'unsigned int'},
'destPort': {'type': 'SCKA_LinkInPort'}}}, 'SCKA_LinkInNode': {'properties': {'src_Id': {'type': 'unsigned int'},
'srcSlot_Id': {'type': 'unsigned int'}}}, 'SCKA_LinkInPort': {'properties': {'dstSlotId': {'type': 'unsigned int'},
'dstPortId': {'type': 'unsigned int'}, 'speedLevel': {'type': 'unsigned int'}, 'dstNeId': {'type': 'unsigned int'},
'fiberType': {'type': 'unsigned int'}}}}



tom = values[0].values()

list: [{'properties': {'portID': {'type': 'unsigned int'}, 'slotID': {'type': 'unsigned int'}, 'destPort': {'type':
'SCKA_LinkInPort'}}}, {'properties': {'src_Id': {'type': 'unsigned int'}, 'srcSlot_Id': {'type': 'unsigned int'}}},
{'properties': {'dstSlotId': {'type': 'unsigned int'}, 'dstPortId': {'type': 'unsigned int'}, 'speedLevel': {'type':
'unsigned int'}, 'dstNeId': {'type': 'unsigned int'}, 'fiberType': {'type': 'unsigned int'}}}]


tom = [ values[0] ]
list: [{'SCKA_TopoPort': {'properties': {'portID': {'type': 'unsigned int'}, 'slotID': {'type': 'unsigned int'},
'destPort': {'type': 'SCKA_LinkInPort'}}}, 'SCKA_LinkInNode': {'properties': {'src_Id': {'type': 'unsigned int'},
'srcSlot_Id': {'type': 'unsigned int'}}}, 'SCKA_LinkInPort': {'properties': {'dstSlotId': {'type': 'unsigned int'},
'dstPortId': {'type': 'unsigned int'}, 'speedLevel': {'type': 'unsigned int'}, 'dstNeId': {'type': 'unsigned int'},
'fiberType': {'type': 'unsigned int'}}}}]

猜你喜欢

转载自www.cnblogs.com/tianhu9102/p/10124295.html
今日推荐