0
data_portgroup = {"data_portgroup" : ["DataPortGroup1", "DataPortGroup2"]}
mgmt_portgroup = {"mgmt_portgroup" : ["MgmtPortGroup1", "MgmtPortGroup2"]}
trunk_portgroup = {"trunk_portgroup" : ["TrunkPortGroup1", "TrunkPortGroup2"]}
而且我有一個列表:
portgroups = ["VM Network",
"VMPortGroup1",
"DataPortGroup1",
"f7b64e53-cdb0-4bb6-b479-8c8aa6a5ab10",
"TrunkPortGroup1",
"dvSwitch-DVUplinks-232",
"MgmtPortGroup1",
"dvPortGroup",
"dvSwitchOVSvApp-DVUplinks-69",
"dvSwitchBootVMs-DVUplinks-61"
]
現在我想查詞典值出現在列表中?
你似乎有你提到的「字典」多個詞典,我假設你想檢查他們所有的? –
你的問題不明確。什麼是預期的輸出? – thefourtheye
是,對於每個data_portgroup「DataPortGroup1」存在於列表中或不存在。以同樣的方式將檢查下一個字典。 – Amby