本文介绍了如何在循环python emacs中停止无限循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了这段代码:

x = 0
while x == 0:
      print 'd'

当我键入Cc时!

现在的问题是:我如何停止执行该代码?

Now the question is: How I stop the execution of that code?

推荐答案

非常感谢您的回答。最终我得到了解决方案。这是我的分步操作方法。

Many thanks for our answers. Finaly I got the solution. Here is my step by step how-to.

Omri Barel,Pavel Repin,jmdeldin的信用额

起点是:pythontests.py文件中的while循环,

Startpoint is: infinite while loop in pythontests.py file,


  1. Cc! (打开python shell)(您看到两个窗口 buffers,光标位于python shell中)

  2. Cx o(切换到其他窗口 buffer)(现在是pythontests。 py文件高亮显示)

  3. 抄送CC(执行代码)(行开始移动并计数:))

  4. Cx o(切换到其他窗口缓冲区)(现在是python shell高亮显示)

  5. Cc Cc(停止运行进程)(现在您看到引用消息)

  1. C-c ! (open the python shell)(you see two windows "buffers", cursor is in the python shell)
  2. C-x o (switch to other window "buffer") (now is the pythontests.py file highlited)
  3. C-c C-C (execute the code)(the lines begin to move and count :))
  4. C-x o (switch to other window "buffer") (now is the python shell highlited)
  5. C-c C-c (stops running process) (now you see the Trackback message)

在我的情况下,我收到此消息:

In my case I got this message:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/python-4684wEr.py", line 3, in <module>
    print 'd'
KeyboardInterrupt

这是截屏视频:

这篇关于如何在循环python emacs中停止无限循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 09:51