久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術文章
文章詳情頁

Python語言規范之Pylint的詳細用法

瀏覽:123日期:2022-06-15 18:05:49
1、Pylint是什么

pylint是一個Python源代碼中查找bug的工具,能找出錯誤,和代碼規范的運行。也就是你的代碼有Error錯誤的時候能找出來錯誤,沒有錯誤的時候,能根據Python代碼規范給你建議修改代碼,讓代碼變更美觀。

2、安裝pylint

pip3 install pylint3、查找pylint的安裝地址

$ which pylint/Library/Frameworks/Python.framework/Versions/3.9/bin/pylint4、Pycharm使用Pylint工具

1)Pycharm --> Preferences --> Tools --> External Tools --> +

Python語言規范之Pylint的詳細用法

Program:pylint的地址,可以通過which pylint找到地址Arguments:pylint運行的參數2)使用

Python語言規范之Pylint的詳細用法

3)得到的結果

************* Module 704leetcode/704.py:28:0: C0305: Trailing newlines (trailing-newlines) #文尾有多余的行leetcode/704.py:1:0: C0114: Missing module docstring (missing-module-docstring) # 腳本首行沒有添加注釋leetcode/704.py:4:11: W0621: Redefining name ’nums’ from outer scope (line 23) (redefined-outer-name) #變量名字與函數參數名字不能一樣leetcode/704.py:4:28: W0621: Redefining name ’target’ from outer scope (line 24) (redefined-outer-name) #變量名字與函數參數名字不能一樣leetcode/704.py:4:0: C0116: Missing function or method docstring (missing-function-docstring) #函數缺少注釋,注釋要放在函數的第一行而不是def的上面5、pylint的5種信息類型

Output: Using the default text output, the message format is : MESSAGE_TYPE: LINE_NUM:[OBJECT:] MESSAGE There are 5 kind of message types : * (C) convention, for programming standard violation * (R) refactor, for bad code smell * (W) warning, for python specific problems * (E) error, for probable bugs in the code * (F) fatal, if an error occurred which prevented pylint from doing further processing.

* (C) 約定,用于違反編程標準

* (R) 重構,針對糟糕的代碼味道

* (W) 警告,針對 python 特定問題

* (E) 錯誤,用于代碼中可能的錯誤

* (F) 致命的,如果發生錯誤導致 pylint 無法進行進一步處理。

6、更多的pylint信息

1)可以通過命令行獲取

pylint --list-msgs

2)官網

http://pylint.pycqa.org/en/latest/#

以上就是Python語言規范之Pylint的使用的詳細內容,更多關于Python Pylint的使用的資料請關注好吧啦網其它相關文章!

標簽: Python 編程
相關文章:
主站蜘蛛池模板: 盱眙县| 永登县| 冀州市| 邛崃市| 惠安县| 岗巴县| 莱州市| 彭阳县| 张家口市| 苏尼特左旗| 雷波县| 筠连县| 广元市| 柏乡县| 城口县| 土默特右旗| 内黄县| 辛集市| 恩平市| 黑龙江省| 深水埗区| 滕州市| 海林市| 三门县| 云南省| 柳林县| 太和县| 铜陵市| 阳谷县| 罗平县| 大化| 南皮县| 宁化县| 安泽县| 沛县| 安仁县| 南召县| 开鲁县| 临沧市| 调兵山市| 依兰县|