在 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