Created
February 17, 2011 22:08
-
-
Save neilkod/832839 to your computer and use it in GitHub Desktop.
converts JMW canabalt data into my format
This file contains hidden or 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
#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