[Tutor] reading a csv file
Sunil Tech
sunil.techspk at gmail.com
Tue Apr 15 08:06:42 CEST 2014
Hi,
#!/usr/bin/python
import csv
import sys
def main():
cr = csv.reader(open("data.csv","rb"))
for row in cr:
print row
if __name__ == "__main__":
sys.exit(main())
when i run this...
i get
Traceback (most recent call last):
File "data.py", line 14, in <module>
sys.exit(main())
File "data.py", line 9, in main
cr = csv.reader(open("data.csv","rb"))
AttributeError: 'module' object has no attribute 'reader'
can anyone correct me please.
thank you in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140415/df5272c0/attachment.html>
More information about the Tutor
mailing list