mercredi 1 août 2018

Python Syntax error in for loop

I am trying to extract some particular data from the JSON so i wrote the following code

echo "$Group_ID" | python -c 'import json,sys;obj=json.load(sys.stdin); for o in obj: if o[name] == "Admin_UserGroup": print o["id"]';

But its throwing error

Can someone please help and tell me what wrong with the code?

File "", line 1
import json,sys;obj=json.load(sys.stdin); for o in obj: if o[name] == "Admin_UserGroup": print o["id"]

Here is the version details

[root@mdfdevha1 ~]# python -V
Python 2.7.5

EDIT 1 : Attaching the image

enter image description here

Aucun commentaire:

Enregistrer un commentaire