Can anyone suggest a better way of returning the values in a dictionary as a single list. I have the following, but it uses a nested loop, not sure if there is a more efficient way.
thanks
Code:
>>> d['a']= [(45,6)] >>> d['a'].append((56,4)) >>> d['a'] [(45, 6), (56, 4)] >>> s =[] >>> for i, j in enumerate(d['a']): ... for k, l in enumerate(j): ... s.append(l) ... >>> s [45, 6, 56, 4] >>>
Comment