Apr-13-2019, 01:33 AM
Look at:
It's now a string you try to get key from not a dictionary,just to make your error.
halo = json.loads(j) print(halo) # json.loads() should give back a python dictionary print(type(halo))
for user in halo:
will loop over key
in dictionary,not both key and values.It's now a string you try to get key from not a dictionary,just to make your error.
>>> s = 'foo' >>> s['faceAttributes'] Traceback (most recent call last): File "<interactive input>", line 1, in <module> TypeError: string indices must be integers # So a string need integer,but this is not what you want >>> s[0] 'f'