[Tutor] reading a csv file
Sunil Tech
sunil.techspk at gmail.com
Tue Apr 15 08:18:49 CEST 2014
Please ignore previous email.
this error occurred as i had previously created .pyc file...
after deleting that .pyc file.. now it is working fine.
Thank you.
On Tue, Apr 15, 2014 at 11:36 AM, Sunil Tech <sunil.techspk at gmail.com>wrote:
> 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/995521cd/attachment.html>
More information about the Tutor
mailing list