Created
September 23, 2011 04:07
-
-
Save nolochemical/1236732 to your computer and use it in GitHub Desktop.
SimpleJson CRUD
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 characters
#! /usr/bin/python2 | |
import simplejson as json | |
def save_profile(): | |
pfile = ".profile" # {'settings':{'clean_cache_close':908}} | |
pfile_handle = open(pfile, "r+") | |
preader = pfile_handle.readline() | |
tmp = json.loads(preader) | |
tmp['settings']['clean_cache_close'] = 18 | |
print tmp # print the whole json string, save it, whatever | |
save_profile() | |
>>>{'settings':{'clean_cache_close':18}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment