So I am not very good with keyboard event handling in Python. I have read the Python Curses tutorial on their official website and looked for answers on SO but it still does not make sense to me. So for starters I want to make a simple program that when it takes a key press such as Escape it prints something simple like You pressed escape!. Sorry I have no code, this is because I do not really know where to start. I think it might have something to do with using functions but I am not sure. You guys do not even have to give me the exact answer but just hints to where I should start! 
Heres the code I tried:
from msvcrt import getch
while True:
    key = ord(getch())
    if key == 27: #ESC
        print'You pressed ESC'
but it didnt work? Any ideas?