Skip to content Skip to sidebar Skip to footer

Simplejson And Random Key Value

Here is the value i got from API server {'query':{'pages':{'-1':{'ns':0,'title':'spencerx','missing':''}}}} Let say if i want to get determine if it's not missing word, i will kn

Solution 1:

try print x['query']['pages'].keys(), which would give you ['-1'] for the first case and ['1080152'] for the second one.

if you just want to check '-1' in x['query']['pages']:

if'-1'in x['query']['pages']:
   # dictionary x['query']['pages'] has '-1'as a key

would suffice

Post a Comment for "Simplejson And Random Key Value"