def getdictvalue(d,code): result=[] if isinstance(d, dict) : try: value = d[code] result.append(value) except Exception as e: pass for valuedd in d.values(): if isinstance(valuedd,dict): yied_result=getdictvalue(valuedd,code) if len(yied_result) != 0…
方法一:Key Value 直接获取 databases = {1: 'Student', 2: 'School'} for k,v in databases.items(): print(k,v) 1 Student 2 School 方法二:通过循环Key获取Value databases = {1: 'Student', 2: 'School'} for k in databases: print(k,databases[k])…