<div dir="ltr"><div><div>Hi,<br><br></div>I'm trying to write a list of dictionaries like:<br><br></div>people = (<br>         {'name':'john', 'age':12} ,<br>         {'name':'kacey', 'age':18} <br>    )<br><div><div><br><br></div><div>I've thought the code below would do the task.<br><br></div><div>But it doesn't work.<br><br></div><div>And if I "print(people)" what I get is not the organize data structure like above.<br></div><div><br></div><div>Thanks of any help!<br></div><div>[]s<br></div><div>Gilcan<br></div><div><br></div><div>#!/usr/bin/env python<br></div><div>from collections import defaultdict<br><br>person = defaultdict(dict)<br>people = list() <br><br>person['name'] = 'jose'<br>person['age'] = 12<br><br>people.append(person)<br><br>person['name'] = 'kacey'<br>person['age'] = 18<br><br>people.append(person)<br><br>for person in people:<br>    print( person['nome'] )<br><br></div></div></div>