Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
109 มุมมอง

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 

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
มี.ค. 25
1159
0
ม.ค. 25
3205
1
ส.ค. 23
14477
change password แก้ไขแล้ว
1
ส.ค. 23
13158
1
ก.ค. 23
10163