COVID_9102 发表于 2021-8-26 15:19:38

str没有marketrans属性如何解决?

python 3.9.6
VS Code

>>> str1 = "xiaoxie,DAXIE"
>>> print(str1.translate(str.marketrans('a','b')))
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
    print(str1.translate(str.marketrans('a','b')))
AttributeError: type object 'str' has no attribute 'marketrans'

冬雪雪冬 发表于 2021-8-26 15:21:36

拼写错误
maketrans

COVID_9102 发表于 2021-8-26 15:22:36

尴尬{:5_107:}
页: [1]
查看完整版本: str没有marketrans属性如何解决?