相关疑难解决方法(0)

Python 2 maketrans()函数不适用于Unicode:"参数是不同的长度",当它们实际上是

[Python 2] SUB = string.maketrans("0123456789","Ο12 26 5")

此代码产生错误:

ValueError: maketrans arguments must have same length
Run Code Online (Sandbox Code Playgroud)

我不确定为什么会发生这种情况,因为字符串长度相同.我唯一的想法是下标文本长度与标准大小的字符有某种不同,但我不知道如何解决这个问题.

python string unicode translate python-2.x

8
推荐指数
1
解决办法
3953
查看次数

标签 统计

python ×1

python-2.x ×1

string ×1

translate ×1

unicode ×1