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
待更新..
posted @ 2020-06-05 16:02  呆呆杏  阅读(1746)  评论(0)    收藏  举报