Skip to content

Instantly share code, notes, and snippets.

@neilkod
Created February 17, 2011 22:08
Show Gist options
  • Save neilkod/832839 to your computer and use it in GitHub Desktop.
Save neilkod/832839 to your computer and use it in GitHub Desktop.
converts JMW canabalt data into my format
#Basically splits the method of death and the device
#!/bin/python
import sys, re
canabalt_regexp = re.compile(r'"(.*) on my ([^.]+)\."')
for line in sys.stdin:
data = line.strip()
try:
user,score,method_of_death = data.split(',')
(death,device) = canabalt_regexp.search(method_of_death).groups()
print ','.join([score,death,device])
except:
# these are lines with bad data. we can just throw them out.
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment