79168555

Date: 2024-11-08 02:03:51
Score: 1
Natty:
Report link

Turns out I just needed to do a little more reading. os._exit(0) is what works.

import time
import keyboard as kb
import sys
import os

def on_hotkey():
    print('hotkey')
    os._exit(0)
    
kb.add_hotkey('ctrl + q', on_hotkey )
for i in range(3):
    print('Hello')
    time.sleep(5)
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: elscan