Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ascii codes are not correct #27

Open
g3rb3n opened this issue Mar 4, 2019 · 2 comments
Open

Ascii codes are not correct #27

g3rb3n opened this issue Mar 4, 2019 · 2 comments

Comments

@g3rb3n
Copy link

g3rb3n commented Mar 4, 2019

Many ascii codes are incorrect. 'X', 'K' and '_' do have code 0 according to the code. Many other keys like arrow keys get an ascii code from 81 to 84, while those are reserved for QRST.

@g3rb3n
Copy link
Author

g3rb3n commented Mar 4, 2019

lstrip removes all specified characters.
https://python-reference.readthedocs.io/en/latest/docs/str/lstrip.html

so 'XK_X'.lstrip('XK_') will result in an empty string.

return name.lstrip("XK_")

Should be

return name[3:]

@g3rb3n
Copy link
Author

g3rb3n commented Mar 4, 2019

return number % 256

will result in overlapping asciivalues

return number if number < 256 else 0

won't

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant