How to write native newline character to a file descriptor in Python?

前端 未结 2 399
粉色の甜心
粉色の甜心 2020-12-14 06:11

The os.write function can be used to writes bytes into a file descriptor (not file object). If I execute os.write(fd, \'\\n\'), o

2条回答
  •  庸人自扰
    2020-12-14 07:04

    How about os.write(, os.linesep)? (import os is unnecessary because you seem to have already imported it, otherwise you'd be getting errors using os.write to begin with.)

提交回复
热议问题