📜  ord python3 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:21.168000             🧑  作者: Mango

代码示例1
# ord('a') means 'get unicode of a'
ord('a') = 97

# chr(97) is the reverse, and means 'get ascii of 97'
chr(97) = 'a'

# to get the int val of a single digit represented as a char, do the following:
# ord(single_digit_char) - ord('0') = single_digit_int
ord('5') - ord('0') = 5
ord('3') - ord('0') = 3