How to remove a dict of dicts | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to remove a dict of dicts

I have the following dict: dict_values([{1: Gastos_usuario_bd(username='Maria2', id_gasto=1, fecha_hora=datetime.datetime(2020, 12, 9, 18, 41), monto=290000.0, categoria='Mercado', observacion='', tipo_gasto='Variable'), 2: Gastos_usuario_bd(username='Maria2', id_gasto=2, fecha_hora=datetime.datetime(2020, 12, 2, 15, 9), monto=600000.0, categoria='Arriendo', observacion='', tipo_gasto='Fijo'), 3: Gastos_usuario_bd(username='Maria2', id_gasto=3, fecha_hora=datetime.datetime(2020, 11, 12, 11, 50), monto=34510.0, categoria='Futbol', observacion='Salida con mis hijos', tipo_gasto='Variable')}, {1: Gastos_usuario_bd(username='Eduardo1', id_gasto=1, fecha_hora=datetime.datetime(2020, 11, 12, 11, 50), monto=350000.0, categoria='Entretenimiento', observacion='Salida a comer con los amigos de la U', tipo_gasto='Variable')}]) I want to remove the ([ which are a tuple and list....Please tell what I can do?

11th Dec 2020, 4:24 AM
Rosana Rodríguez Milanés
Rosana Rodríguez Milanés - avatar
3 Answers
+ 3
Can't try to help you with partial code like that. Got error 'Gastos_usuario_bd' is undefined.
11th Dec 2020, 6:48 AM
Ipang
0
Gastos_uduarios_bd is a BaseModel
11th Dec 2020, 3:08 PM
Rosana Rodríguez Milanés
Rosana Rodríguez Milanés - avatar
0
I am going to try with the pop method
11th Dec 2020, 3:08 PM
Rosana Rodríguez Milanés
Rosana Rodríguez Milanés - avatar