Python中感叹号操作符(!)的等效写法是什么?
在C/C++中,感叹号(!)符号被定义为 not 操作符。Python中的等效写法是not操作符。它返回True,当操作数为False时,反之亦然。
>>> not(True)
False
>>> not(False)
True
>>> not(20>30)
True
>>> not('abc'=='ABC')
True
更多Python相关文章,请阅读:Python 教程
在C/C++中,感叹号(!)符号被定义为 not 操作符。Python中的等效写法是not操作符。它返回True,当操作数为False时,反之亦然。
>>> not(True)
False
>>> not(False)
True
>>> not(20>30)
True
>>> not('abc'=='ABC')
True
更多Python相关文章,请阅读:Python 教程