python学习笔记十六:读取JSON文件

读取JSON文件可以用JSON库,示例代码:

#coding:utf-8
import json

with open("msg.json") as jsonfile:
    json_data = json.load(jsonfile)
    for key in json_data:
        val = json_data[key]
        print key + '\t' + val

 

posted @ 2015-02-05 14:34  观海云不远  阅读(1627)  评论(0编辑  收藏  举报