fork download
  1. res = {'SGMB': [['SGMB', 'SANTM', 'CRSR', 'RAT']], 'CRSR': [['SGMB', 'SANTM', 'CRSR', 'RAT'], ['CRSR', 'RAT', 'ARG']], 'RAT': [['ARG', 'RAT'], ['SGMB', 'SANTM', 'CRSR', 'RAT'], ['CRSR', 'RAT', 'ARG']], 'PARTICIPANT_COLL_ID': [['PARTICIPANT_COLL_ID']], 'ARG': [['ARG', 'RAT'], ['CRSR', 'RAT', 'ARG']], 'SANTM': [['SGMB', 'SANTM', 'CRSR', 'RAT']]}
  2. newres = {k: list({x for t in v for x in t if x != k}) for k, v in res.iteritems()}
  3. print(newres)
Success #stdin #stdout 0.07s 8888KB
stdin
Standard input is empty
stdout
{'SGMB': ['CRSR', 'SANTM', 'RAT'], 'CRSR': ['SANTM', 'SGMB', 'RAT', 'ARG'], 'RAT': ['CRSR', 'SANTM', 'SGMB', 'ARG'], 'PARTICIPANT_COLL_ID': [], 'ARG': ['CRSR', 'RAT'], 'SANTM': ['CRSR', 'RAT', 'SGMB']}