ASCII Character Code Table Generator

  • Share this:

Code introduction


This function takes a string as input and outputs each character along with its ASCII code.


Technology Stack : String manipulation

Code Type : Function

Code Difficulty : Intermediate


                
                    
def ascii_table(text):
    """
    将字符串转换为ASCII字符画表
    """
    ascii_art = ""
    for char in text:
        ascii_art += f"{ord(char)}: {char}  "
    return ascii_art