Skip to content

Instantly share code, notes, and snippets.

@trsqxyz
Last active August 29, 2015 14:22
Show Gist options
  • Save trsqxyz/4c4a02b1ad265b6cb521 to your computer and use it in GitHub Desktop.
Save trsqxyz/4c4a02b1ad265b6cb521 to your computer and use it in GitHub Desktop.
>>> for s in ('C-c', 'C-s', 'C-r'):
... print(s)
... msvcrt.getch()
...
C-c
b'\x03'
C-s
b'\x13'
C-r
b'\x12'
>>> boc = lambda x: bytes([ord(chr(x))])
>>> ctr = dict(zip(('C-c', 'C-r', 'C-s'), list(map(boc, (3, 18, 19)))))
>>> ctr
{'C-c': b'\x03', 'C-s': b'\x13', 'C-r': b'\x12'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment