About the conversion of ASCII code

ASCII code table

insert image description here

Conversion between ASCII codes and characters

The two functions chr() and ord() in python can realize the conversion between ASCII codes and characters. Examples
of relationship conversion between the two
insert image description here

string='bsuahisas'
num_list=[ord(i) for i in string]
str_list=[chr(i) for i in num_list]
print(num_list)
print(str_list)

operation result
insert image description here

Guess you like

Origin blog.csdn.net/m0_54510474/article/details/121622388