英文文档:

ord(c)
Given a string representing one Unicode character, return an integer representing the Unicode code point of that character. For example, ord('a') returns the integer 97 and ord('€') (Euro sign) returns 8364. This is the inverse of chr().

 

说明:
  1. 函数功能传入一个Unicode 字符,返回其对应的整数数值。
>>> ord('a')
97
>>> ord('@')
64

  2. 其功能和chr函数刚好相反。

>>> chr(97)
'a'
>>> chr(64)
'@'

 

相关文章:

  • 2021-08-16
  • 2022-12-23
  • 2021-05-26
  • 2021-07-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-03
  • 2021-11-15
  • 2022-12-23
  • 2021-07-21
  • 2021-08-29
  • 2022-12-23
相关资源
相似解决方案