Skip to content

Instantly share code, notes, and snippets.

@NorthIsUp
Created April 16, 2012 01:51
Show Gist options
  • Save NorthIsUp/2395944 to your computer and use it in GitHub Desktop.
Save NorthIsUp/2395944 to your computer and use it in GitHub Desktop.
4zak
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