Why is KeyboardInterrupt not working in python?

前端 未结 4 1777
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-19 00:01

Why doesn\'t code like the following catch CTRL-C?

MAXVAL = 10000
STEP_INTERVAL = 10

for i in range(1, MAXVAL, STEP_INTERVAL):
    try:
        print str(i)         


        
4条回答
  •  眼角桃花
    2020-12-19 00:42

    Sounds like the program is done by the time control-c has been hit, but your operating system hasn't finished showing you all the output. .

提交回复
热议问题