Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
140 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona
Risposta migliore

res[project_id'][0] will print 5

res[project_id'][1] will print toto114 

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
0
mar 25
1219
0
gen 25
3275
1
ago 23
14578
1
ago 23
13236
1
lug 23
10240