如何撤消真=假在Python交互模式? [英] How do I undo True = False in python interactive mode?

查看:128
本文介绍了如何撤消真=假在Python交互模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我想恶的东西奈德Deily在他的回答中提到的here.现在我有一个真正的类型永远是现在假。我将如何交互窗口内扭转这个?

事情不能做:

 真=假

由于真现在已经完全覆盖假,似乎没有要到后台跟踪一个明显的方式。是否有真正的来自一个模块,我可以这样做:

 真=<'模块'> .TRUE


解决方案

您可以简单地<一个href=\"https://docs.python.org/2/reference/simple_stmts.html#grammar-token-del_stmt\"><$c$c>del您的自定义名称,设置回默认的:

 &GT;&GT;&GT;真=假
&GT;&GT;&GT;真正

&GT;&GT;&GT;德尔真
&GT;&GT;&GT;真正
真正
&GT;&GT;&GT;

So I tried the "evil" thing Ned Deily mentioned in his answer here. Now I have that the type True is now always False. How would I reverse this within the interactive window?

Thing to not do:

True = False

Since True has now been completely overridden with False, there doesn't seem to be an obvious way to back-track. Is there a module that True comes from that I can do something like:

True = <'module'>.True

解决方案

You can simply del your custom name to set it back to the default:

>>> True = False
>>> True
False
>>> del True
>>> True
True
>>>

这篇关于如何撤消真=假在Python交互模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆