Skip to Content
Menú
This question has been flagged
2 Respostes
238 Vistes

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
Best Answer

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
Best Answer

res[project_id'][0] will print 5

res[project_id'][1] will print toto114 

Avatar
Descartar
Related Posts Respostes Vistes Activitat
0
de març 25
1418
0
de gen. 25
3495
1
d’ag. 23
14856
1
d’ag. 23
13508
1
de jul. 23
10486