Created
April 16, 2012 01:51
-
-
Save NorthIsUp/2395944 to your computer and use it in GitHub Desktop.
4zak
This file contains 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 characters
import json | |
import os | |
seed = [] | |
foo = os.path.expanduser("~/foo.json") | |
def load(): | |
with open(foo, 'r') as fp: | |
return json.load(fp) | |
def save(obj): | |
with open(foo, 'w') as fp: | |
return json.dump(obj, fp, indent=2) | |
save(seed) | |
for x in range(100): | |
data = load() | |
data.append(x) | |
save(data) | |
with open(foo, 'r') as fp: | |
print "".join(fp.readlines()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment