为什么文本文件要用一个空行做结尾?
使用flake8做python代码检查的时候,大家会碰到一个常见的问题:
no newline at end of fileflake8(W292)
那么为什么flake8要求文件有空行做结尾呢?
POSIX 定义文件中一行的标准:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
A sequence of zero or more non- <newline> characters plus a terminating <newline> character.
也就是说:如果一行不是以新的一行结尾,那它就不算真正的行