请帮助我从python中的以下json获取gRecaptchaResponse密钥
+----------+--------------+-------------------+------------------------+
| user_id | user_name | user_created_by | user_created_by_name |
+----------+--------------+-------------------+------------------------+
| 3 | Paul | 2 | NULL |
+----------+--------------+-------------------+------------------------+
答案 0 :(得分:1)
resp = {'errorId': 0, 'status': 'ready', 'solution': {'gRecaptchaResponse': '03030359652SF_JNFDjddfjkjDJFKLjfds+5d6sa5d+6S56C562CS+5sc9SC262jfdsjfJDF'}, 'cost': '0.112200', 'createTime': 1537281783, 'endTime': 1537281806, 'solveCount': 0}
#for key
print(list(resp['solution'].keys())[0])
#for value
print(resp['solution']['gRecaptchaResponse'])
答案 1 :(得分:0)
您可以尝试一下:
json_data = {'errorId': 0, 'status': 'ready', 'solution': {'gRecaptchaResponse': '03030359652SF_JNFDjddfjkjDJFKLjfds+5d6sa5d+6S56C562CS+5sc9SC262jfdsjfJDF'}, 'cost': '0.112200', 'createTime': 1537281783, 'endTime': 1537281806, 'solveCount': 0}
g_key = json_data['solution']['gRecaptchaResponse']