在 Python 中停止无限循环的键盘指令是什么?
任何循环都形成于执行一定次数或直到满足一定条件为止。但是,如果该条件并未出现,循环将无限重复。需要通过生成键盘中断强制停止此类无限循环。按 ctrl-C 停止执行无限循环
>>> while True:
print ('hello')
hello
hello
hello
hello
hello
hello
Traceback (most recent call last):
File "<pyshell#18>", line 2, in <module>
print ('hello')
KeyboardInterrupt
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程语言
C++
C#
MongoDB
MySQL
Javascript
PHP