Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #44231
| References | <9d0d46e5-b579-4edc-be34-0aa8798b66f8@googlegroups.com> <mailman.1000.1366753795.3114.python-list@python.org> <665fa76f-3a19-414b-8524-c2a5bfa8b21b@googlegroups.com> |
|---|---|
| Date | 2013-04-23 15:34 -0700 |
| Subject | Re: Reading a CSV file |
| From | Dan Stromberg <drsalists@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1005.1366756987.3114.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
On Tue, Apr 23, 2013 at 2:58 PM, Ana Dionísio <anadionisio257@gmail.com>wrote:
> Thank you, but can you explain it a little better? I am just starting in
> python and I don't think I understood how to apply your awnser
> --
> http://mail.python.org/mailman/listinfo/python-list
>
#!/usr/local/pypy-1.9/bin/pypy
import csv
def main():
with open('test.csv', 'r') as file_:
for row in csv.reader(file_, delimiter="|"):
print row
main()
# Example input:
# abc|def|ghi
# jkl|mno|pqr
In this way, you get one row at a time, instead of all rows at once.
HTH
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Reading a CSV file Ana Dionísio <anadionisio257@gmail.com> - 2013-04-23 14:39 -0700
Re: Reading a CSV file Dan Stromberg <drsalists@gmail.com> - 2013-04-23 14:49 -0700
Re: Reading a CSV file Ana Dionísio <anadionisio257@gmail.com> - 2013-04-23 14:58 -0700
Re: Reading a CSV file Ana Dionísio <anadionisio257@gmail.com> - 2013-04-23 15:40 -0700
Re: Reading a CSV file Fábio Santos <fabiosantosart@gmail.com> - 2013-04-24 00:30 +0100
Re: Reading a CSV file Dave Angel <davea@davea.name> - 2013-04-23 23:18 -0400
Re: Reading a CSV file Dan Stromberg <drsalists@gmail.com> - 2013-04-23 15:34 -0700
csiph-web