İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
215 Görünümler

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
Vazgeç
En İyi Yanıt

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
Vazgeç
En İyi Yanıt

res[project_id'][0] will print 5

res[project_id'][1] will print toto114 

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
0
Mar 25
1411
0
Oca 25
3492
1
Ağu 23
14845
change password Çözüldü
1
Ağu 23
13498
1
Tem 23
10479