Created
July 18, 2012 22:33
-
-
Save mattwigway/3139409 to your computer and use it in GitHub Desktop.
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
from sys import argv | |
import csv | |
writer = csv.writer(open('out.csv', 'w')) | |
print 'Weeks start on Monday.' | |
with open('out.csv', 'w') as out: | |
writer = csv.writer(out) | |
for infname in argv[1:]: | |
with open(infname) as inf: | |
reader = csv.DictReader(inf) | |
rows = [row for row in reader] | |
if len(rows) == 0: | |
continue | |
print infname | |
print 'n', 'service_id'.center(15), 'M', 'T', 'W', 'R', 'F', 'S', 'S' | |
for i in range(len(rows)): | |
row = rows[i] | |
print i, row['service_id'].center(15), row['monday'], row['tuesday'],\ | |
row['wednesday'], row['thursday'], row['friday'], row['saturday'],\ | |
row['sunday'] | |
while True: | |
rowNum = raw_input('Choose: ') | |
try: | |
row = rows[int(rowNum)] | |
except: | |
continue | |
else: | |
break | |
writer.writerow([infname, row['service_id']]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment