python 区别None与数字0 在python条件判定中,有时候会遇到输入的内容为数字0,假如a=0,如果我们直接用if not a那么会把数字0也排除在外,而实际项目中,尤其是读取Excel表里的数值时,我们需要读取这个数字0。解决办法如下: a={} if not a and a!=0: print('这是None') else: print('这是数字0')