Skip to content

Instantly share code, notes, and snippets.

@ojacobson
Forked from idcmp/hello.py
Last active December 17, 2015 11:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ojacobson/5603149 to your computer and use it in GitHub Desktop.
Save ojacobson/5603149 to your computer and use it in GitHub Desktop.
__author__ = 'idcmp'
import json
def handle_westie_results(results):
print results
dancers = {}
success = 0
failures = 0
for wscid in xrange(1, 10140):
directory = wscid / 10
try:
with open('SDC/results/%s/%s.json' % (directory, wscid), 'r') as fd:
dancers[wscid] = json.load(fd)
success += 1
except IOError, e:
failures += 1
print "Database contains %s parsed results and %s failures." % (success, failures)
divisions = set()
for wscid, dancer in dancers.iteritems():
for division in dancer['results']:
divisions.add(division['name'])
print "Database contains %s Divisions." % (len(divisions),)
for division in divisions:
print " " + division
dancer = dancers[3125]
for division in dancer['results']:
if division['name'] == 'West Coast Swing':
handle_westie_results(division)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment