言简意赅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
相关文章
相关标签/搜索