Skip to content

Instantly share code, notes, and snippets.

@tomkel
Created October 13, 2013 14:42
Show Gist options
  • Save tomkel/6963083 to your computer and use it in GitHub Desktop.
Save tomkel/6963083 to your computer and use it in GitHub Desktop.
#!/bin/python
import csv
files = ['qb.csv', 'rb.csv', 'wr.csv', 'te.csv', 'flex.csv', 'dst.csv', 'k.csv']
for fileName in files:
with open(fileName, 'r+') as file:
rows = [row[8:len(row)] for row in file]
if fileName == 'dst.csv':
for i in range(len(rows)):
row = str(rows[i])
row = row[0:len(rows[i]) - 1]
players = row.split(',')
row = ''
for player in players:
row = row + player[player.rindex(' '):len(player)] + ' D/ST,'
rows[i] = row[0:len(row) - 1] + '\n' # remove comma
file.seek(0)
file.truncate()
file.writelines(rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment