Skip to content

Instantly share code, notes, and snippets.

@perone
Created December 7, 2012 18:48
Show Gist options
  • Save perone/4235462 to your computer and use it in GitHub Desktop.
Save perone/4235462 to your computer and use it in GitHub Desktop.
reading csv table
>>> import pprint
>>> fh = open("alunos.txt")
>>> d = { v.split()[0]:v.split()[1:] for v in fh.readlines() }
>>> fh.close()
>>> pprint.pprint(d)
{'Beltrano': ['5.6', '7.8', '9.4', '5.3'],
'Fulano': ['8.3', '7.6', '9.5', '6.4'],
'Sicrano': ['5.6', '8.9', '7.4', '7.5']}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment