whats the easiest way of converting a character into its ascii equivalent in python?
本问题已经有最佳答案,请猛点这里访问。
Possible Duplicate:
ASCII value of a character in python
我应用的方法是映射数组中的字符。有图书馆吗?
Given a string of length one, return
an integer representing the Unicode
code point of the character when the
argument is a unicode object, or the
value of the byte when the argument is
an 8-bit string. … This is the
inverse ofchr() for 8-bit strings and
ofunichr() for unicode objects.
1 | ord('a') |
显示"assuming ASCII值,那就是你的要求。如果你的意思是Unicode字符,当时的一位更棘手的一个映射将是最好的方式做它。