PEP 305 - CSV File API
Roman Suzi
rnd at onego.ru
Sat Feb 1 08:50:12 EST 2003
On Fri, 31 Jan 2003, Skip Montanaro wrote:
> * What about conversion to other file formats? Is the list-of-lists
> output from the csvreader sufficient to feed into other writers?
It could also be interesting to be able to use attribute access
to fields:
for row in cvsreader:
... row.field1 ...
... row.field2 ...
and dictionary is sometimes needed, like in this example:
for row in cvsreader:
print "%(field1)s - %(field2)s" % row.field1
But these examples assume I need to provide names to fields.
(Those examples are from my log parsing code. Logs are kind of CSV too ;)
That is, there is a need for an optional mechanism to name fields on
reading. However, attribute access is not suitable in case names are
arbitrary, so row["field1"] notation is the only one left.
> http://www.python.org/peps/pep-0305.html
>
> http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/python/python/nondist/sandbox/csv/
Sincerely yours, Roman Suzi
--
rnd at onego.ru =\= My AI powered by Linux RedHat 7.3
More information about the Python-list
mailing list