Created
December 19, 2012 04:23
-
-
Save makotoworld/4334367 to your computer and use it in GitHub Desktop.
Revisions
-
makotoworld created this gist
Dec 19, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ import simplejson ## 書き出し sample = {"@title": "みんなのPython", "author": "柴田淳", "pub": ["SoftBank Creative", "2006"]} file = open("sample.json", "w") simplejson.dump(sample, file, indent=3) ## sample.jsonの中身 #{ # "@title": "みんなのPython", # "pub": [ # "SoftBank Creative", # "2006" # ], # "author": "柴田淳" #} ## 読み込み file = open("sample.json") a = simplejson.load(file) a["@title"] # >> u"みんなのPython"