[英]What code should I use? sys.exit() or some other thing I haven't found?
I'm a high school student in a class that is using Python 2 on Enthought Canopy Windows Edition. 我是一个在Enthought Canopy Windows Edition上使用Python 2的班上的高中学生。 I often get stuck in coding loops, but the only way I can get out is by closing out all forms of open Enthought.
我经常陷入代码循环中,但是我唯一的解决方法是关闭所有形式的开放式Enthought。 Is there any more reliable way to do it?
还有更可靠的方法吗? I've been using sys.exit(0), but it doesn't work correctly, and is leaving my coding in a jam.
我一直在使用sys.exit(0),但是它无法正常工作,并且使我的编码陷入困境。 I can't even test it without it getting me stuck.
没有它,我什至无法测试它。 Anyone know how to fix this issue?
有人知道如何解决此问题吗?
If your code is already running, then you can't reliably type a command to stop it, because the prompt won't necessarily be live then. 如果您的代码已经在运行,则您将无法可靠地键入命令来停止它,因为此时提示不一定会处于活动状态。
Often you can use the Run menu's "Interrupt kernel" command, and you should usually be able to use "Restart kernel", though this doesn't work all the time. 通常,您可以使用“运行”菜单的“中断内核”命令,并且通常应该可以使用“重新启动内核”,尽管这种方法并非始终有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.