赞
踩
PyCharm的Inspect Code提供了代码静态审查功能,可以检测出语法错误,不符合PEP8的代码以及提供建议,方便集中这类问题。
示例代码:
- author = "dgw"
-
-
- def test_func():
- res = '666'
- return res
-
-
- def test_func2():
- res2 = '666'
-
- def inner_func():
- return 666
-
- return res2
-
-
- class Test(object):
- def __init__(self, name, age):
- self.name = name
- self.age = age
-
- def run(self):
- return 666
-
-
- print(dir(Test))
![](https://csdnimg.cn/release/blogv2/dist/pc/img/newCodeMoreWhite.png)
Inspect Code使用:
Inspect Code界面包括两部分:左边列出审查结果,右边操作界面。
点击右边的Reformat file 按钮可以自动格式化代码使之符合PEP8规范。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。