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