I am trying to store dictionaries in a list and then print according to the position in the list, however this is giving a key error ... Code below:
nome = "nomedahora"
cpf = "1421241"
departamento = "bsi"
dicProfessor = {nome: {"nome":nome, "cpf":cpf, "departamento":departamento}}
listaProfessores = []
listaProfessores.append(dicProfessor)
dicProfessor.clear()
for item in listaProfessores:
print(item[nome])
Error:
Traceback (most recent call last): File "C: /Users/Alumn/AppData/Local/Programs/Python/Python36/rqwrqrqr.py", line 18, in print (item [name]) KeyError: 'timename'