Skip to content

Instantly share code, notes, and snippets.

@alyssonbruno
Created December 5, 2012 22:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alyssonbruno/4220070 to your computer and use it in GitHub Desktop.
Save alyssonbruno/4220070 to your computer and use it in GitHub Desktop.
abruno:/tmp$ cat notas.txt
Fulano 8.3 7.6 9.5 6.4
Sicrano 5.6 8.9 7.4 7.5
Beltrano 5.6 7.8 9.4 5. 3
abruno:/tmp$ cat notas.py
notas={}
for linha in open('notas.txt'):
linha_list = linha.strip().split(' ')
notas[linha_list[0]]=linha_list[1:]
print notas
abruno:/tmp$ python notas.py
{'Fulano': ['8.3', '7.6', '9.5', '6.4'], 'Sicrano': ['5.6', '8.9', '7.4', '7.5'], 'Beltrano': ['5.6', '7.8', '9.4', '5.', '3']}
abruno:/tmp$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment