Linked Questions

Popular Questions

Constants in CSV module Python

Asked by At

I am wondering what constants like QUOTE_NONNUMERIC are considered in the CSV module of Python. Perhaps I should understand it, but I don’t.

I have searched the Python documentation to no avail. For the DictWriter class the documentation gives the following:

class csv.DictWriter(f, fieldnames, restval='', extrasaction='raise', 
                     dialect='excel', *args, **kwds)

To me there seems to be an error in the documentation by restval, but I digress.

Later it says the CSV module defines the following ‘constants’.

One of them is csv.QUOTE_NONNUMERIC.

I understand how to use it and where it goes, but there is no reference in the DictWriter class to constants. Are constants simply keyword arguments, i.e., **kwds? If yes, why call them constants instead of keywords? If no, how am I to understand how to use them? (I think I understand them just by viewing other code)

I have also searched stack overflow.
Just wondering.

Related Questions