yaml格式处理

Posted tianhu9102

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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‘}}}}]

































以上是关于yaml格式处理的主要内容,如果未能解决你的问题,请参考以下文章

python实现处理swagger接口文档,转换为yaml格式的自动化用例

python实现处理swagger接口文档,转换为yaml格式的自动化用例

Go 处理yaml类型的配置文件

Python处理yaml和嵌套数据结构的一些技巧

python学习-xml处理,yaml处理,hashlib,subprocess模块

配置化---.ini文件和yaml文件的处理