如何使用Python处理JSON?

如何使用Python处理JSON?,python,json,Python,Json,我对Python非常陌生。我有一个JSON响应,如下所示: { "Code" : "Success", "LastUpdated" : "2012-10-19T08:52:10Z", } 我需要获取code的值,即Success。在Python中如何实现这一点?在中搜索json。你会发现有人用例子解释了 import json # ... you read here from the file data = '''{ "Code" : "Success", "LastUpdat

我对Python非常陌生。我有一个JSON响应,如下所示:

{
  "Code" : "Success",
  "LastUpdated" : "2012-10-19T08:52:10Z",
}

我需要获取
code
的值,即
Success
。在Python中如何实现这一点?

在中搜索
json
。你会发现有人用例子解释了

import json
# ... you read here from the file
data = '''{
  "Code" : "Success",
  "LastUpdated" : "2012-10-19T08:52:10Z"
}'''
result = json.loads(data)
print result['Code']
注意格式!!我删除了
“LastUpdated”:“2012-10-19T08:52:10Z”
之后的逗号,因为这不是有效的json