C
caldwellinva
Hi!
** CSV Dialect Example Requested - NEWBIE **
I would like to use the CSV module and would like to see a working example
that uses a custom dialect. I have tried the following example from an
earlier posting to the group
import csv
import csv
class dialect(csv.dialect):
delimiter = '|'
skipinitialspace = True
quotechar = '"'
doublequote = True
reader = csv.reader(file("c:\\Temp\\test.csv"), dialect=dialect)
for row in reader:
print row
and get the following error
Traceback (most recent call last):
File
"C:\Python23\lib\site-packages\Pythonwin\pywin\framework\scriptutils.py",
line 310, in RunScript
exec codeObject in __main__.__dict__
File "C:\Python23\DougSource\test_csv.py", line 4, in ?
# delimeter = '|'
AttributeError: 'module' object has no attribute 'dialect'
If the example could show the process for registering a name, that would be
helpful as well.
Thank you,
Doug Caldwell
5533 Dunsmore Road
Alexandria, VA 22315
(e-mail address removed)
703-922-8725
** CSV Dialect Example Requested - NEWBIE **
I would like to use the CSV module and would like to see a working example
that uses a custom dialect. I have tried the following example from an
earlier posting to the group
import csv
import csv
class dialect(csv.dialect):
delimiter = '|'
skipinitialspace = True
quotechar = '"'
doublequote = True
reader = csv.reader(file("c:\\Temp\\test.csv"), dialect=dialect)
for row in reader:
print row
and get the following error
Traceback (most recent call last):
File
"C:\Python23\lib\site-packages\Pythonwin\pywin\framework\scriptutils.py",
line 310, in RunScript
exec codeObject in __main__.__dict__
File "C:\Python23\DougSource\test_csv.py", line 4, in ?
# delimeter = '|'
AttributeError: 'module' object has no attribute 'dialect'
If the example could show the process for registering a name, that would be
helpful as well.
Thank you,
Doug Caldwell
5533 Dunsmore Road
Alexandria, VA 22315
(e-mail address removed)
703-922-8725