据我所知,在 unix 中,始终在文件末尾有空行是一个好习惯 - 或者换句话说:每一行都应该以\n
.
在使用 PEP8 检查我的 python 代码时,我注意到它还指出\n
文件末尾应该有:
W292 no newline at end of file
JCR: The last line should have a newline.
奇怪的是,它与 W391 冲突:
W391 blank line at end of file
JCR: Trailing blank lines are superfluous.
Okay: spam(1)
W391: spam(1)\n
应该如何?我应该在文件末尾有空行吗?