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

Alex Kleider alexkleider at gmail.com
Mon Aug 9 23:53:04 EDT 2021


On Sun, Aug 8, 2021 at 8:20 PM David <bouncingcats at gmail.com> wrote:

>
> It would help us to answer you if you would explain exactly what method
> you are using that shows you this '\M'.
>

I'm using the unix/Linux diff command's output redirected to a file which I
then examine with my editor 'vim'.

>
> The carriage return character is ASCII decimal 13 which can be generated
> by holding the [ctrl] key and pressing the [M] key, sometimes written as
> ctrl-M or ^M. Python represents this character as '\r'.
>
> If a file contains this character, run
>   cat -A <your_filename>
> to display its contents will show this character as '^M',  and line-feed
> character ASCII decimal 10 will be shown as '$' at the end of the line.
>
> To see a hex representation of the characters in a file, run
>   od -A x -t x1z <your_filename>
>

Thanks for these tips.


More information about the Tutor mailing list