Python编程代码规范文章搜集

PEP8的规范:https://blog.csdn.net/u010429481/article/details/79891343

Python编程代码规范(Google Style)

https://blog.csdn.net/zong596568821xp/article/details/81162557

Python之代码规范管理工具

https://blog.csdn.net/zong596568821xp/article/details/84251616

python如何实现代码检查

https://www.jb51.net/article/164177.htm

play.py

from playsound import playsound

#print("1.mp3")
#
#playsound('1.mp3')
n = 1
while n:
	
  musicname = input("pls input musice name:")
  playsound(musicname)
  n = n + 1

用pylint  play.py检查得分:

E:\heqing\1-Pythonkid\test>pylint play.py
************* Module play
play.py:10:0: C0303: Trailing whitespace (trailing-whitespace)
play.py:11:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
play.py:12:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
play.py:13:0: W0311: Bad indentation. Found 2 spaces, expected 4 (bad-indentation)
play.py:1:0: C0114: Missing module docstring (missing-module-docstring)
play.py:8:0: C0103: Constant name "n" doesn't conform to UPPER_CASE naming style (invalid-name)
play.py:11:2: C0103: Constant name "musicname" doesn't conform to UPPER_CASE naming style (invalid-name)
play.py:13:2: C0103: Constant name "n" doesn't conform to UPPER_CASE naming style (invalid-name)

------------------------------------
Your code has been rated at -3.33/10

可怜的-3.33分

C——违反代码风格标准;
R——代码结构较差;
W——关于细节的警告;
E——代码中存在错误;
F——导致Pylint无法继续运行的错误。

参考文章:https://blog.csdn.net/sinat_38682860/article/details/102500606

使用方法:https://blog.csdn.net/weixin_36646275/article/details/83965622

可以对比一下先前的。

再用pylint测一下分数

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值