Skip to content

Instantly share code, notes, and snippets.

@michellesun
Created September 5, 2012 16:00
Show Gist options
  • Save michellesun/3639015 to your computer and use it in GitHub Desktop.
Save michellesun/3639015 to your computer and use it in GitHub Desktop.
Hello Challenge Part 1
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