[Tutor] Terminating "\M" characters with regard to csv.DictWriter

Peter Otten __peter__ at web.de
Tue Aug 10 02:57:26 EDT 2021


On 10/08/2021 06:03, Alex Kleider wrote:
> On Mon, Aug 9, 2021 at 1:14 AM Peter Otten <__peter__ at web.de> wrote:

>> or pick a different dialect
>>
>> writer = csv.writer(outstream, dialect="unix")
>>
>>
>> This got rid of the '\M' at the end of each line but created a new problem
> in that each field was in quotes!!

The line terminator is not the only thing controlled by a dialect. You 
can override the quoting spec with

writer = csv.writer(
     outstream, dialect="unix", quoting=csv.QUOTE_MINIMAL
)

or whatever quoting style you prefer.



More information about the Tutor mailing list