Closed caihuan123456 closed 5 years ago
问题已解决,楼主不用看了 在打开文件时,手工指定newline参数为""即可避免空行
参考源码 def open(file, mode='r', buffering=None, encoding=None, errors=None, newline=None, closefd=True):
On input, if newline is None, universal newlines mode is enabled. Lines in the input can end in '\n', '\r', or '\r\n', and these are translated into '\n' before being returned to the caller. If it is '', universal newline mode is enabled, but line endings are returned to the caller untranslated.
@caihuan123456 在代码里加newline='',貌似还是不行嘛!