嗨,我在 python3.4.2 中有以下代码:
s='416f1c7918f83a4f1922d86df5e78348'; w="0123456789abcdef"; x=''.join([chr(w.index(s[i])*16+w.index(s[i+1])) if(i%2==0) else '' for i in range(len(s))]); print(x);
它显示了这个错误
UnicodeEncodeError:
'ascii' codec can't encode character '\xf8' in position 5: ordinal not in range
(128)
为什么会这样?python3中的 chr 不应该超过 128 吗?