了解编码类型

时间:2012-02-29 01:13:42

标签: language-agnostic encoding

我有一个应用程序,它将我的字符串中的每个字符转换为3digit数字,它似乎是像ASCII这样的东西,但不是那样,我试图弄明白但我无法理解:

somefunction(){
   a => 934 // a will be converted to 934
   b => 933 // b will be converted to 933
   1 => 950 // 1 will be converted to 950
   0 => 951 // 0 will be converted to 951
}

我知道ASCII,但我不明白这一点,如果知道这是什么类型的编码类型,请帮助。

谢谢你:)

1 个答案:

答案 0 :(得分:1)

这是一种可能性(ord返回角色的ASCII值),但我认为你确实需要更多的数据点来确定。

>>> for c in 'ab10': print c, 999 - ord(c.upper())
...
a 934
b 933
1 950
0 951