Created
December 18, 2020 10:50
-
-
Save ralfstx/445d801236762f4aa21ee42b72f8961d to your computer and use it in GitHub Desktop.
Python script to print an ASCII table to the console
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
#!/usr/bin/python3 | |
header="DEC HEX CHR" | |
spacer=" " * 5 | |
def row(i): | |
return f"{i:3} {i:02x} {chr(i)} " | |
if __name__ == "__main__": | |
print(spacer.join((header for _ in range(6)))) | |
for i in range(16): | |
print(spacer.join((row(32+i+16*c) for c in range(6)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment