在Python 2.x的真=假赋值 [英] True=False assignment in Python 2.x
本文介绍了在Python 2.x的真=假赋值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:结果
<一href=\"http://stackoverflow.com/questions/2055029/why-cant-python-handle-true-false-values-as-i-expect\">Why不能Python的处理真/假值,如我所料?
好像一个愚蠢的问题,但为什么在Python下面的语句没有明确禁止的?
Seems a stupid question, but why is the following statement in Python not explicitly forbidden?
>> True=False
>> True
False
如何真
和假
被Python间preTER处理?
How is True
and False
handled by Python interpreter?
推荐答案
真
,就像 STR
或其他内置的,仅仅是存在于默认范围的名称。你可以重新绑定它像任何其他类似的名字。
True
, just like str
or any other builtin, is just a name that exists in the scope by default. You can rebind it like any other such name.
这篇关于在Python 2.x的真=假赋值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文