Skip to content

Instantly share code, notes, and snippets.

@voyeg3r
Created March 2, 2010 21:38
Show Gist options
  • Select an option

  • Save voyeg3r/319980 to your computer and use it in GitHub Desktop.

Select an option

Save voyeg3r/319980 to your computer and use it in GitHub Desktop.
python - Le um arquivo delimitado e mostra os campos na tela.
""" 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