十萬個爲什麼!

目錄

1、 “#noqa”在Python評論中意味着什麼?


1、 “#noqa”在Python評論中意味着什麼?

import sys
sys.path.append(r'C:\dev')
import some_module   # noqa

 答案:

將#noqa添加到一行表示linter(一個自動檢查代碼質量的程序)不應該檢查此行.代碼可能生成的任何警告都將被忽略。那條線可能有一些“看起來很糟糕”的東西,但開發商理解並打算出於某種原因它在那裏

有關更多信息,請參閱<a href="http://flake8.pycqa.org/en/latest/user/violations.html#in-line-ignoring-errors" rel="noreferrer">Flake8 documentation for Selecting and Ignoring Violations</a>

參見: http://www.cocoachina.com/articles/69350 


 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章