最佳答案
我有这个密码:
class A(object):
@staticmethod
def open():
return 123
@staticmethod
def proccess():
return 456
switch = {
1: open,
2: proccess,
}
obj = A.switch[1]()
当我运行这个命令时,我不断得到错误:
TypeError: 'staticmethod' object is not callable
怎么解决呢?