Python PEP8 代碼規范問題記錄
PEP 8: no newline at end of file 代碼末尾需要另起一行
PEP 8: indentation is not a multiple of four 縮進不是4的倍數,檢查縮進
PEP 8: over-indented 過度縮進,檢查縮進
PEP 8: missing whitespace after’,’ 逗號后缺少空格
PEP 8: multiple imports on one line 不要在一行 import 中引用多個庫
PEP 8: blank line at end of line 刪除代碼末尾的空格
PEP 8: at least two spaces before inline comment 代碼與注釋之間至少有兩個空格
PEP 8: block comment should start with ‘#’ 注釋要以#加一個空格開始
PEP 8: inline comment should start with ‘#’ 注釋要以#加一個空格開始
PEP 8: module level import not at top of file import 不在文件的頂部
PEP 8: expected 2 blank lines,found 0 需要兩條空行
PEP 8: function name should be lowercase 函數名應該是小寫字母
PEP 8: missing whitespace around operator 操作符 ( ' = '、' > '、' < ' 等 ) 前后缺少空格
PEP 8: E305 expected 2 blank lines after class or function definition, found 1 在類的定義以及函數定義之后需要空兩行
PEP 8: E722 do not use bare 'except' 在捕獲異常時,請盡可能的提及特定的異常,而不要使用裸except:
子句。
其他
每行盡量不要超過80個字符,如果超過,可以用小括號“()”將多行內容隱式連接。(過長的url除外)