Created
December 7, 2012 18:48
-
-
Save perone/4235462 to your computer and use it in GitHub Desktop.
reading csv table
This file contains 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
>>> 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