言簡意賅python系列---if not x: 和 if x is not None: 和 if not x is None: 的區別

在看代碼時有幾個邏輯關係一直很模糊,今天來捋一捋:python if not x: if x is not None if not x is None: 開始以前你必需要有一個這樣的認識,清楚x等於None, False, 空字符串"", 0, 空列表[], 空字典{}, 空元組()時對你的判斷沒有影響才行。 即:web not None == not False == not '' == not
相關文章
相關標籤/搜索