I want to interrupt my while True
loop in below code but it does not work:
try:
while True:
print(1)
except KeyboardInterrupt:
print('interrupted!')
exit()
I am running this code in PyCharm. Why isn't Ctrl+C triggering KeyboardInterrupt
?