Skip to content

Instantly share code, notes, and snippets.

@kgleeson
Created March 5, 2012 10:19
Show Gist options
  • Save kgleeson/1977753 to your computer and use it in GitHub Desktop.
Save kgleeson/1977753 to your computer and use it in GitHub Desktop.
import csv
text = csv.reader(open('evoreg.csv', 'rb'), delimiter=';')
idList = ['Name', 'Boards', 'Age', 'Email', 'Games', 'Date']
for row in text:
gamesList = row[5].split(',')
print '='*80
for id, data in enumerate(row[1:7]):
if not id == 4:
print '%-10s : %s' % (idList[id] , data)
else:
for i in gamesList:
if i is gamesList[0]:
print '%-10s : %s' % ('Games', i)
continue
if len(gamesList) > 1:
print '%-10s : %s' % ('', i)
idDict = {1:'Name', 2:'Boards', 3:'Age', 4:'Email', 5:'Games', 6:'Date'}
for row in text:
gamesList = row[5].split(',')
print '='*80
for id in idDict:
if not id == 5:
print '%-10s : %s' % (idDict[id] , row[id])
else:
for i in gamesList:
if i is gamesList[0]:
print '%-10s : %s' % ('Games', i)
continue
if len(gamesList) > 1:
print '%-10s : %s' % ('', i)
@kgleeson
Copy link
Author

kgleeson commented Mar 5, 2012

Take:
"7";"Farzad";"antigirl";"27";"qasimf@tcd.ie";"SSF4AEv2012,SFxTEkken Teams,uMVC3,Mortal Kombat";"26-02-2012";"z5tylcu07434ct0z03v";"0"

Output:

================================================================================
Name       : Farzad
Boards     : antigirl
Age        : 27
Email      : qasimf@tcd.ie
Games      : SSF4AEv2012
           : SFxTEkken Teams
           : uMVC3
           : Mortal Kombat
SignupDate : 26-02-2012
================================================================================

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment