Se rendre au contenu
Menu
Cette question a été signalée
2 Réponses
223 Vues

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
Ignorer
Meilleure réponse

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
Ignorer
Meilleure réponse

res[project_id'][0] will print 5

res[project_id'][1] will print toto114 

Avatar
Ignorer
Publications associées Réponses Vues Activité
0
mars 25
1414
0
janv. 25
3493
1
août 23
14848
1
août 23
13499
1
juil. 23
10480