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 containing all the alphabetic characters in the string along with their ASCII values.
Technology Stack : String, dictionary, loop, conditional statement, character encoding
Code Type : Function
Code Difficulty : Beginner
def ascii_table(text):
"""
将字符串转换为ASCII字符表。
"""
table = {}
for char in text:
if char.isalpha():
table[char] = ord(char)
return table