You can download this code by clicking the button below.
This code is now available for download.
This function takes a string as input and returns a dictionary where the keys are the characters in the string and the values are their corresponding ASCII codes.
Technology Stack : String, Dictionary, built-in function ord()
Code Type : Function
Code Difficulty : Beginner
def ascii_table(text):
"""
打印给定文本的ASCII码表。
"""
result = {}
for char in text:
result[char] = ord(char)
return result