sorting - Python - order dictionary data -


this question has answer here:

my knowledge python low. trying order data dictionary , not know how. have tried ordereddict, sort , variable.sorted got errors.

what have tried:

textos_informativos = [] t in c.producto.textos:     textos_informativos.append(dict(orden=t.orden,                                     tipo=t.tipo.nombre,                                     informacion=t.informacion)) 

i order data based on "t.orden" data (int).

thanks,

i've tryied:

from collections import ordereddict          textos_informativos = []     t in c.producto.textos:        textos_informativos.append(ordereddict(orden=t.orden,                                        tipo=t.tipo.nombre,                                        informacion=t.informacion)) 

nothing happened.


textos_informativos = []   t in c.producto.textos:        textos_informativos.append(dict(orden=t.orden,                                        tipo=t.tipo.nombre,                                        informacion=t.informacion))   sorted (textos_informativos, key= t.orden) 

error 'int' object not callable


textos_informativos = []   t in c.producto.textos:        textos_informativos.append(dict(orden=t.orden,                                        tipo=t.tipo.nombre,                                        informacion=t.informacion))   t.orden.sort() 

error 'int' object has no attribute 'sort'



Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -