Iterating over dictionary with lists values
I have a dictionary and in one it's key/value, this value is a list. I'm trying to iterate over this dict to remove special characters (this is part is ok), but when I get this value (which is a list) I don't know how to do.
This is my dict:
{
"id_pessoa_ies": "3",
"cpf": "string",
"nome": "TESTE COM Ç E ESPACO E É",
"nome_social": "string",
"sexo": "string",
"data_nascimento": "26-11-2020",
"cor_raca": "Preta",
"estado_civil": "Test word here",
"municipio_naturalidade": "Test again",
"uf_naturalidade": "TEST",
"pais_nascimento": "string",
"docente_pessoa": [
{
"id_docente_ies": "string",
"matricula": "123456789",
"titulacao": "TEST",
"ano_ingresso": "2020",
"tipo_contrato": "string",
"tipo_vinculo": "TESTE COM Ç E ESPACO E É ARROBA @ #",
"id_unidade_lotacao": "1",
"situacao": "ACTIVATE"
}
]
}
This is what I did so far:
for key, value in mydict.items():
if key == 'docente_pessoa':
# what should I do here to iterate over 'docente_pessoa' to get it's values and
# apply my function 'text_to_it()' on it?
else:
text = text_to_id(value)
mydict.items[key] = text
I appreciate any help.
Thank you
from Recent Questions - Stack Overflow https://ift.tt/2J3qSjq
https://ift.tt/eA8V8J
Comments
Post a Comment