[Tutor] reading a csv file
Sunil Tech
sunil.techspk at gmail.com
Tue Apr 15 10:36:53 CEST 2014
yes Alan, what you said is true.
Thank you.
On Tue, Apr 15, 2014 at 1:40 PM, Alan Gauld <alan.gauld at btinternet.com>wrote:
> On 15/04/14 07:06, Sunil Tech wrote:
>
>> Hi,
>>
>> #!/usr/bin/python
>>
>> import csv
>> import sys
>>
>> def main():
>> cr = csv.reader(open("data.csv","rb"))
>> for row in cr:
>> print row
>>
>
> when i run this...
>>
>>
>> cr = csv.reader(open("data.csv","rb"))
>> AttributeError: 'module' object has no attribute 'reader'
>>
>>
> The most common cause of this error is that you have
> created a file called csv.py which is masking the
> library module.
>
> Could that be the case here?
>
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.flickr.com/photos/alangauldphotos
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140415/0345f02f/attachment.html>
More information about the Tutor
mailing list