PyCharm 3的PEP8代码风格警告提示信息

PyCharm好心的PEP8提示却有碍代码观感,怎样才能关闭我不需要的警告信息呢?


通过Google发现了如下信息:

In pycharm, click the settings icon, or go to the settings via the menu bar.
In the project settings section, click ‘inspections’
In the list that appears, click ‘python’.
Under python, scroll down and click PEP8.
Now, underneath the description, you’ll se an ‘ignore errors’ section. Click the + at the bottom.
Now, go here. This is a page of the pep8.py documentation, listing all possible errors and warnings.
Find an error you want to ignore, and copy the error code at the left.
Paste this error code into the field you just added in the settings window.
Add all the errors you want to ignore and click apply.

主要是在PyCharm项目设置中找到inspections选项,然后找到PEP 8 coding style violation,在右边的ignore errors,点击下面的加号,添加要忽略的警告信息编码,这个编码可以参考PEP8.py的官方网站,如下图所示我添加了E221、E401、E203这几个要忽略的信息。

只要取消掉PEP8风格警告和校验警告即可:


后来JetBrains的开发者Dmitry Jemerov与作者联系提供了一个更为简便的办法,那就是点击要忽略的错误所在,然后按Alt+Enter,在弹出下拉菜单选择ignore errors like this,就可以快速忽略了。


  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值