if event.char == event.keysym:
    print('Normal Key %r' % event.char)
elif len(event.char) == 1:
    print('Punctuation Key %r (%r)' % (event.keysym, event.char))
else:
    print('Special Key %r' % event.keysym)
root = tk.Tk()
print('Press a key (Escape key to exit):')
root.bind_all('<Key>', key)
root.withdraw()
root.mainloop()
How to get input as a Left Arrow key?