s = [('value0', 'value1', 'value2'), ('value0', 'value1', 'value2'), ('value0', 'value1', 'value2')] res = dict() for i, tpl in enumerate(s, 1): for ii, value in enumerate(tpl, 1): res.setdefault(i, dict()).setdefault("key%s" % ii, value) print res
s = [('value0', 'value1', 'value2'), ('value0', 'value1', 'value2'), ('value0', 'value1', 'value2')] res = dict() for i, tpl in enumerate(s, 1): for ii, value in enumerate(tpl, 1): res.setdefault(i, dict()).setdefault("key%s" % ii, value) print res