Why truncate when we open a file in 'w' mode in python

前端 未结 8 2130
再見小時候
再見小時候 2020-12-13 05:40

I am going through Zed Shaw\'s Python Book. I am currently working on the opening and reading files chapters. I am wondering why we need to do a truncate, when we are alread

8条回答
  •  孤城傲影
    2020-12-13 06:22

    That's just a reflection of the standard posix semantics. see man fopen(3). Python just wraps that.

提交回复
热议问题