python 这个是怎么回事呢?

来源:互联网 发布:淘宝服装模特拍摄 编辑:程序博客网 时间:2024/04/30 18:33
a='\xf\x001\xabc\02'

SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 0-2: truncated \xXX escape


把a改成'\x0f\x001\xabc\02'就对了


也就是说

‘\x0f’有效

‘\xf’无效

\xXX必须两位

即时'\x0'同样无效

0 0