Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
67 Vistas

Hi guys!!!!!

Please i have this result :

[{'project_id': (5, u'toto114'), 'id': 21}]

I want to get the first value in project_id field which means the 5.

Please what can i do!!!!!

print res[project_id'][0]????

Thanks in advance :)

Avatar
Descartar
Mejor respuesta

Let's assume,

result = [{'project_id': (5, u'toto114'), 'id': 21}]

If you want to get value "5" then use following syntex,

print result[0]['project_id'][0] 

Avatar
Descartar
Mejor respuesta

res[project_id'][0] will print 5

res[project_id'][1] will print toto114 

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
0
mar 25
1021
0
ene 25
3107
1
ago 23
14262
1
ago 23
12973
1
jul 23
9998