Open files in 'rt' and 'wt' modes

后端 未结 4 1563
故里飘歌
故里飘歌 2020-11-29 19:54

Several times here on SO I\'ve seen people using rt and wt modes for reading and writing files.

For example:

with open(\'in         


        
4条回答
  •  佛祖请我去吃肉
    2020-11-29 20:39

    t indicates for text mode

    https://docs.python.org/release/3.1.5/library/functions.html#open

    on linux, there's no difference between text mode and binary mode, however, in windows, they converts \n to \r\n when text mode.

    http://www.cygwin.com/cygwin-ug-net/using-textbinary.html

提交回复
热议问题