德摩根定律,
"not (A and B)" is the same as "(not A) or (not B)"also,"not (A or B)" is the same as "(not A) and (not B)".
就您而言,根据第一条陈述,您已经有效地撰写了
if not (i == "" and i == " "):
这是不可能发生的。因此,无论输入是什么,
(i == "" and i == " ")都将始终返回,
False而取反则将
True始终给出。
相反,您应该这样写
if i != "" and i != " ":
或根据De Morgan引用的第二条陈述,
if not (i == "" or i == " "):



