python布尔运算符
In python, not is used for Logical NOT operator, and ~ is used for Bitwise NOT. Here, we will see their usages and implementation in Python.
在python中, not用于逻辑NOT运算符,而〜用于按位NOT。 在这里,我们将看到它们在Python中的用法和实现。
Logical NOT (not) operator is used to reverse the result, it returns "False" if the result is "True"; "True", otherwise.
逻辑NOT(非)运算符用于取反结果,如果结果为“ True”,则返回“ False”。 否则为“ True”。
Bitwise NOT (~) operator is used to invert all the bits i.e. it returns the one's complement of the number.
按位NOT(〜)运算符用于将所有位取反,即它返回一个数字的补码。
Python program of Logical NOT (not) operator
逻辑NOT(非)运算符的Python程序
# Logical NOT (not)