I have seen other posts, and searched for a while and read documentation. But I cannot seem to understand the answers. Closest I got was the signal module, but the documentation confused me honestly. I need to break from a loop, without using raw_input, the Ctrl-C is perfect, except I need to change it to activate if the user clicks SPACE or ENTER.
from time import sleep
try:
while True:
print "I'm looping!"
sleep(1)
except KeyboardInterrupt:
print "The loop has ended!"
This loop would be perfect If i could just change the keys for the KeyboardInterrupt error.