John Machin wrote:
> tobiah wrote:
>>>
>>>
>> I agree with Henryk's evaluation
>
> Henryk?? Have I missed a message in the thread, or has the effbot
> metamorphosed into the aitchbot?
>
How strange. Either my client was whacked, or I was. I was
actually referring to your "baroque byzantine ov
tobiah wrote:
> >
> >
> >
>
> I agree with Henryk's evaluation
Henryk?? Have I missed a message in the thread, or has the effbot
metamorphosed into the aitchbot?
--
http://mail.python.org/mailman/listinfo/python-list
>> The docs clearly state what the defaults are, but they are not
>> in the code. It seems so clumsy to have to specify every one of
>> these, just to change the delimiter from comma to tab.
>>
>> http://docs.python.org/lib/csv-fmt-params.html :
>
> The "it defaults to" clauses should probably
tobiah wrote:
>> you may be misreading the docs; the Dialect has no values at all, and
>> must be subclassed (and the subclass must provide settings).
>
> The docs clearly state what the defaults are, but they are not
> in the code. It seems so clumsy to have to specify every one
> of these,
tobiah wrote:
> > However, more generally, the docs also clearly state that "In addition
> > to, or instead of, the dialect parameter, the programmer can also
> > specify individual formatting parameters, which have the same names as
> > the attributes defined below for the Dialect class."
>
> I d
> However, more generally, the docs also clearly state that "In addition
> to, or instead of, the dialect parameter, the programmer can also
> specify individual formatting parameters, which have the same names as
> the attributes defined below for the Dialect class."
I definitely missed that. Kn
tobiah wrote:
>
> The docs clearly state what the defaults are, but they are not
> in the code. It seems so clumsy to have to specify every one
> of these, just to change the delimiter from comma to tab.
>
That particular case is handled by the built-in (but cunningly
concealed) 'excel-tab' clas
for row in csv.reader(instream, delimiter="\t"):
Awesome. Thanks.
--
Posted via a free Usenet account from http://www.teranews.com
--
http://mail.python.org/mailman/listinfo/python-list
tobiah wrote:
>> you may be misreading the docs; the Dialect has no values at all, and
>> must be subclassed (and the subclass must provide settings).
>
> The docs clearly state what the defaults are, but they are not
> in the code. It seems so clumsy to have to specify every one
> of these, jus
tobiah> So now it works, but it is still strange about the absent
tobiah> defaults.
The csv.Dialect class is essentially pure abstract. Most of the time I
subclass csv.excel and just change the one or two things I need.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
> you may be misreading the docs; the Dialect has no values at all, and
> must be subclassed (and the subclass must provide settings).
The docs clearly state what the defaults are, but they are not
in the code. It seems so clumsy to have to specify every one
of these, just to change the delim
>
> That's possible but why didn't you follow the way `csv.Dialect` set the
> class attributes?
>
> class MyDialect(csv.Dialect):
> delimiter = '\t'
> lineterminator = '\n'
> # and so on…
Because I'm hung over.
--
Posted via a free Usenet account from http://www.teranews.com
--
tobiah wrote:
> The docs are a little terse, but I gather that I am supposed
> to subclass cvs.Dialect:
>
> class dialect(csv.Dialect):
> pass
>
> Now, the docs say that all of the attributes have reasonable
> defaults, but instantiating the above gives:
you may be misreading the docs;
In <[EMAIL PROTECTED]>, tobiah wrote:
> I'm trying to create a cvs.reader object using a custom dialect.
>
> The docs are a little terse, but I gather that I am supposed
> to subclass cvs.Dialect:
>
> class dialect(csv.Dialect):
> pass
>
> Now, the docs say that all of the attributes ha
Ok, I'm an idiot. I didn't even pass my dialect
object to the reader() call.
So now it works, but it is still strange about
the absent defaults.
Tobiah
> This runs, but the delimiter is still the comma.
> When list.csv is comma delim, it works correctly,
> but when list.csv has tab separated v
I'm trying to create a cvs.reader object using a custom dialect.
The docs are a little terse, but I gather that I am supposed
to subclass cvs.Dialect:
class dialect(csv.Dialect):
pass
Now, the docs say that all of the attributes have reasonable
defaults, but instantiating the above gives
16 matches
Mail list logo