تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
118 أدوات العرض

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 :)

الصورة الرمزية
إهمال
أفضل إجابة

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] 

الصورة الرمزية
إهمال
أفضل إجابة

res[project_id'][0] will print 5

res[project_id'][1] will print toto114 

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
0
مارس 25
1178
0
يناير 25
3239
1
أغسطس 23
14511
change password تم الحل
1
أغسطس 23
13192
1
يوليو 23
10197