This is not a savage, this is a list of dictionaries!
EDIT: And to make this a bit more of an answer:
users = [{'id':1010,'name':"Administrator",'type':1},{'id':1011,'name':"Administrator2",'type':1}] newusers = dict() for ud in users: newusers[ud.pop('id')] = ud print newusers #{1010: {'type': 1, 'name': 'Administrator'}, 1011: {'type': 1, 'name': 'Administrator2'}} newusers[1012] = {'name': 'John', 'type': 2} print newusers #{1010: {'type': 1, 'name': 'Administrator'}, 1011: {'type': 1, 'name': 'Administrator2'}, 1012: {'type': 2, 'name': 'John'}}
This is essentially the same as dawgs, but with a simplified approach to creating a new dictionary
source share