Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odgovori
110 Prikazi

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
Opusti
Best Answer

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
Opusti
Best Answer

res[project_id'][0] will print 5

res[project_id'][1] will print toto114 

Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
0
mar. 25
1159
0
jan. 25
3205
1
avg. 23
14478
1
avg. 23
13158
1
jul. 23
10163