I come with my second question, I'm just getting started in programming in python.
To the point:
I'm iterating over the data from a list of dictionaries, and I need to create another list of dictionaries with certain data that I select. The new list is already created empty, the dictionaries I want to be added for each iteration.
This is the idea of the code:
lista_dict_vacia = []
lista_dict_actual = [{'dato1': 'valor1'}, {'dato2': 'valor2'},
{'dato3': 'valor3'}, {'dato4': 'valor4'}]
for item in lista_dict_actual:
if item['dato1'] == item['dato4']:
enviar el item['dato1'] con su valor a lista_dict_vacia
enviar el item['dato4'] con su valor a lista_dict_vacia
De modo que la nueva lista de diccionaios quede así:
lista_dict_vacia = [{'dato1': 'valor1','dato4': 'valor4'}]
I made myself understand? Any help I thank them a million!