Is anyone happy with csv module?

massimo s. devicerandom at gmail.com
Tue Dec 11 16:49:27 EST 2007


On 11 Dic, 22:37, John Machin <sjmac... at lexicon.net> wrote:
> On Dec 12, 6:14 am, "massimo s." <deviceran... at gmail.com> wrote:
>
> > Hi,
>
> > I'm struggling to use the python in-built csv module, and I must say
> > I'm less than satisfied. Apart from being rather poorly documented,
>
> Patches are welcome :-)

Yes, but maybe I was in the wrong. I'm not so bold to submit patches
to an official Python module without asking.
*I* feel troubles, but maybe it's just me being dense.

>
> > I
> > find it especially cumbersome to use,
>
> Can you be more specific? What are you trying to do with it?

See examples in previous post.

> > and also rather limited.
>
> What extra facilities do you think there should be?

Ability to work by columns together with rows and maybe some random
access facilities would be nice. A more user-friendly interface too.

> A CSV file is organised such that each line of the file represents a
> row, and the nth field in the line relates to the nth column, so it's
> natural for any CSV reader/writer to work by rows.

Yes, but it's natural for a spreadsheet-like thing to have organized
columns of data, often.
Often I want those columns to be read into lists, or to write lists
into columns. The actual csv doesn't allow this naturally. Especially
writing is a bit painful.

I just wanted to know if there was something allowing this with a
simple command, that I missed, or if just there wasn't.

> Accessing the data by columns *instead* of by rows would definitely
> not be appreciated by people who are using the csv module to read
> millions of lines of data.

I don't want anything *instead*, I would like *additional*. :)
(Btw: who is using csv to read >10**6 lines of data?)

> > So I have some questions:
> > 1) Is there a good tutorial, example collection etc. on the csv module
> > that I'm missing?
>
> AFAIK, no.

Ok. I found something on google but nothing answering to my questions.

> > 2) Is there an alternative csv read/write module?
>
> Is your googler broken?

Apparently, yes. I googled but apart from some hint here and there of
someone thinking about writing a pure Python csv module, I found
nothing. I'm usually decent at googling, but maybe my skills are
wearing out.

> > 3) In case anyone else is as unhappy as me, and no tutorial etc.
> > enlighten us, and no alternative is present, anyone is interested in
> > an alternative csv module?
>
> -1

Ok. :)

> > I'd like to write one if it is the case.
>
> In what language?

Python.

m.



More information about the Python-list mailing list