Created
October 7, 2017 00:31
-
-
Save berenoguz/b632cebf4c0ebfe1da5246e5d8552ac6 to your computer and use it in GitHub Desktop.
Super simple hex to bin utility
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sys import argv | |
l = 32 | |
s = bin(int(argv[1], 16))[2:].zfill(l) | |
try: | |
i = 2 | |
while argv[i]: | |
argv[i] = int(argv[i]) | |
s = s[:l-argv[i]] + " " + s[l-argv[i]:] | |
l -= argv[i] | |
i += 1 | |
except IndexError: | |
print(s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment