For the tuple, t = ((1, \'a\'),(2, \'b\')) dict(t) returns {1: \'a\', 2: \'b\'}
t = ((1, \'a\'),(2, \'b\'))
dict(t)
{1: \'a\', 2: \'b\'}
Is there a good way to get {\'a\': 1, \'
{\'a\': 1, \'
If there are multiple values for the same key, the following code will append those values to a list corresponding to their key,
d = dict() for x,y in t: if(d.has_key(y)): d[y].append(x) else: d[y] = [x]