Created
September 5, 2012 16:00
-
-
Save michellesun/3639015 to your computer and use it in GitHub Desktop.
Hello Challenge Part 1
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 os | |
import json | |
import bsddb3 as bsddb | |
db = bsddb.btopen("users.db") | |
for filename in os.listdir("."): | |
if not filename.endswith("hello.txt"): | |
continue | |
f = open(filename) | |
for line in f: | |
date, data = line.strip().split(" HELLO ") | |
data = json.loads(data) | |
userid = data['userid'] | |
userid_s = str(userid) | |
appversion = data['app_version'] | |
platform = str(appversion['platform']) | |
hw = (data['hardware_version']).encode('utf-8') | |
db[userid_s] = "%s,%s" %(platform, hw) | |
f.close() | |
db.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment