Skip to content

Instantly share code, notes, and snippets.

@uggedal
Created July 31, 2018 08:05
Show Gist options
  • Save uggedal/a1b90f36ab34d5e340663001499fb350 to your computer and use it in GitHub Desktop.
Save uggedal/a1b90f36ab34d5e340663001499fb350 to your computer and use it in GitHub Desktop.
Convert Nordic Choice bonus list to CSV
#!/usr/bin/env python
import sys
with open(sys.argv[1]) as f:
i = 0
date = None
name = None
points = None
for l in f.readlines():
i += 1
v = l.strip().replace(',', '')
if i == 1:
date = v
if i == 3:
name = v
if i == 5:
points = v.replace('BP.', '').replace(' ', '')
if i == 6:
print(','.join([date, name, points]))
i = 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment