Skip to content

Instantly share code, notes, and snippets.

@ralfstx
Created December 18, 2020 10:50
Show Gist options
  • Save ralfstx/445d801236762f4aa21ee42b72f8961d to your computer and use it in GitHub Desktop.
Save ralfstx/445d801236762f4aa21ee42b72f8961d to your computer and use it in GitHub Desktop.
Python script to print an ASCII table to the console
#!/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