#辞書のキーと値を入れ替えるスクリプト dict_data = {1: 'a', 2: 'b', 3: 'c', 4: 'd', 5: 'e'} #A-1 def d_change_a(d): di = {} for k in d: di[d[k]] = k return dict(di) print d_change_a(dict_data) #A-2 def d_change_a2(d): for k in d: d[d.pop(k)] = k return d print d_change_a2(dict_data) #B-1 print dict((lambda d:[(d[k], k) for k in d])(dict_data)) #B-2 def_lambda = lambda d:[(d[k], k) for k in d] temp_list = def_lambda(

