GlobalScope has an enum of scancodes called
KEY_*. For example,
KEY_A = 65.
You can use this to do something like:
if event is InputEventKey:
if event.scancode == KEY_A:
# do stuff
If you're checking lots of keys you can use a match statement or a dictionary here.
If you have the scancode and want to know the name of the key you can use
OS.get_scancode_string() which will return the "name" of the key as a string, i.e. “Escape”, “Shift+Escape”.
OS.find_scancode_from_string() does the opposite.