我有一个解析yaml文件并提取键/值对并打印它们的脚本,但我在输出中不断获得单引号。
如何摆脱引号?
YML代码段
AsNum:
description: Local AS for BGP global
format: string
type: string
脚本功能
def getVals(dict):
for key,value in dict.items():
#print(keys)
if isDict(value):
if key != "properties" and key != "items":
print(key)
getVals(value)
else:
print("key: ", key, " value: ", value)
示例输出
AsNum
('key: ', 'type', ' value: ', 'string')
('key: ', 'description', ' value: ', 'Local AS for BGP global')
('key: ', 'format', ' value: ', 'string')