Created
March 2, 2010 21:38
-
-
Save voyeg3r/319980 to your computer and use it in GitHub Desktop.
python - Le um arquivo delimitado e mostra os campos na tela.
This file contains hidden or 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
| """ Le um arquivo delimitado e mostra os campos na tela. | |
| source: http://aprenda-python.blogspot.com/2008/10/exemplo-3-ler-arquivo-csv-e-mostrar.html | |
| """ | |
| import csv | |
| print __doc__ | |
| f = csv.reader(open('fones.txt'), delimiter=';') | |
| for [nome,nasc,fone] in f: | |
| print 'nome=%s | nasc=%s | fone=%s' % (nome,nasc,fone) | |
| print f.line_num, 'linhas lidas' | |
| print '--- fim' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment