在命令行中终止 python for 循环程序而不关闭它?

Terminating python for loop program in the command line without closing it?

当我在 Windows 8 的命令终端中打开 python 2.7.9 并且我 运行 这个程序时:

while True:

    for i in ["/","-","|","\","|"]:

        print "%s\r" % i,

如何在不关闭命令终端的情况下终止该程序?如果这是一个新手问题,我提前道歉,但在编程方面我仍然是一个菜鸟,我很少使用命令终端。谢谢! :)

一般来说,我发现 Ctrl+c 可以胜任。 keyboard interrupt 应该在 windows 和 linux

上的 interpreter/terminal 中停止大多数 python activity