Re: Importing a csv file
- From: Tim Golden <mail@xxxxxxxxxxxxxxx>
- Date: Mon, 30 Apr 2007 10:21:19 +0100
sagar wrote:
Hi all ,
I want to read data in a csv file using the python scripts.
when i gave the following code :
import csv
reader = csv.reader(open("some.csv", "rb"))
for row in reader:
print row
it is showing :
Traceback (most recent call last):
File "csv.py", line 1, in <module>
import csv
File "C:\Documents and Settings\meesa02\csv.py", line 2, in <module>
reader = csv.reader(open("some.csv", "rb"))
AttributeError: 'module' object has no attribute 'reader'
You almost certainly have a file called "csv.py" in
the current directory. (Maybe even the one that's
running this script?). Rename it to "mycsv.py" or
whatever and try again.
TJG
.
- Follow-Ups:
- Re: Importing a csv file
- From: John Machin
- Re: Importing a csv file
- References:
- Importing a csv file
- From: sagar
- Importing a csv file
- Prev by Date: Re: What's the life time of the variable defined in a class function?
- Next by Date: Re: While we're talking about annoyances
- Previous by thread: Importing a csv file
- Next by thread: Re: Importing a csv file
- Index(es):
Relevant Pages
|