for h_id, p_id in rt_list_: print assets_[h_id] if assets_[h_id] not in assets_projects: assets_projects[assets_[h_id]] = {project_name_id[p_id]: p_id} elif assets_[h_id] in assets_projects: assets_projects[assets_[h_id]].update({project_name_id[p_id]: p_id})
assets_projects = {} for h_id, p_id in rt_list_: if not assets_projects.get(assets_[h_id]): assets_projects[assets_[h_id]] = {project_name_id[p_id]: p_id} elif assets_projects.get(assets_[h_id]): assets_projects[assets_[h_id]].update({project_name_id[p_id]: p_id})
print assets_projects
|