我尝试运行以下使用 python 3.2 的程序,出现错误:'module' object has no attribute 'atoi' 谁能告诉我我该怎么做才能解决这个问题?对此,我真的非常感激 !
import string
def converttoint(str):
try:
value = string.atoi(str)
return value
except ValueError:
return None
Run Code Online (Sandbox Code Playgroud) 我尝试运行以下使用python 3.2的程序,有错误:'module'对象没有属性'div'任何人都可以告诉我该怎么做才能解决这个问题?对此,我真的非常感激 !
import operator
ops = {'+':operator.add,'-':operator.sub,'*':operator.mul,'/':operator.div}
Run Code Online (Sandbox Code Playgroud)
AttributeError:'module'对象没有属性'div
python-3.x ×2