ASCII Values of Characters in String

  • Share this:

Code introduction


This function takes a string as an argument and returns a list of ASCII values for each character in the string.


Technology Stack : String

Code Type : String processing

Code Difficulty : Beginner


                
                    
def ascii_table(text):
    """
    输出给定文本的ASCII码表。
    """
    result = ""
    for char in text:
        result += f"{ord(char):4} "
    return result                
              
Tags: