Created
July 28, 2016 18:59
-
-
Save lukaskollmer/17034f5ca0bcd69750bb2b2b05b01014 to your computer and use it in GitHub Desktop.
livejson pretty error
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 livejson | |
import datetime | |
def save_new_count2(username, count): | |
date = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") | |
with livejson.File("../db2.json", pretty=True) as db: | |
try: | |
db[username][date] = count | |
except: | |
db[username] = {} | |
db[username][date] = count | |
if __name__ == "__main__": | |
import time | |
save_new_count2('lukaskollmer', 5) | |
save_new_count2('luketaylor', 5) | |
time.sleep(2) | |
save_new_count2('lukaskollmer', 10) | |
save_new_count2('luketaylor', 10) | |
time.sleep(2) | |
save_new_count2('lukaskollmer', 15) | |
save_new_count2('luketaylor', 15) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment