环境:linuxmint terminal utf-8 python2.7.6
代码如下:
#可以用16进制 >>> print '\xe5\x90\x83' 吃 #可以用8进制 >>> '%o %o %o'% (0xe5,0x90,0x83) '345 220 203' >>> print '\345\220\203' 吃 #不可以用10进制 >>> '%d %d %d'% (0xe5,0x90,0x83) '229 144 131' >>> print '\229\144\131' 9dY
问题:
为什么这里使用10进制的数,就没有办法被正确识别出来?
A backslash followed by a number is an “escape character”
Transfer character rules
ddd three octal digits
xhh two hexadecimal digits
For details:
http://baike.baidu.com/link?url=Xk4gncQiT9fRjBkPCNzDBa58Q52DwJ4ldsB2kTcAxvJge0mg2AyT0JY0Y05nhfnLuKujguySGKsc2qq5WZFCLq