Python遇到的一些问题


1. 定义不为空的列表时,如果使用append()会报警告
        this list creation could be rewritten as a list literal
   推荐定义时直接赋值
     list1 = [1,2,3] # 这么用好
     list1 = [1,2,3]   # 这么用不好
     list1.append(4)
2. 打开普通文件不要用b,直接w
        TypeError: a bytes-like object is required, not 'str'
     with open('aoao.cnf', 'wb') as cfg   # 这么用不对
3. 函数参数报如下警告,请检查文档注释参数名称是否未定义或写错
        This inspection detects mismatched parameters in a docstring.
Please note that it doesn’t warn you of missing parameters, if none of them is mentioned in a docstring
待更新..


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM