摘要: 代码中经常会有变量是否为None的判断,有三种主要的写法: 第一种是`if x is None`; 第二种是 `if not x:`; 第三种是`if not x is None`(这句这样理解更清晰`if not (x is None)`) 。 `if x is not None`是最好的写法,清 阅读全文
posted @ 2017-08-24 11:08 行知散人 阅读(219064) 评论(0) 推荐(9) 编辑