You can download this code by clicking the button below.
This code is now available for download.
Converts each character in the input string to its ASCII code and displays it in a tabular format. Each ASCII code takes a fixed width, default is 10.
Technology Stack : String (str), built-in function (ord)
Code Type : String processing
Code Difficulty : Intermediate
def ascii_table(text, width=10):
table = ""
for char in text:
table += f"{ord(char):{width}d} "
return table.strip()