如果我有一个 Python 类,并且想根据变量从中调用一个函数,我该怎么做?我想象以下可以做到:
class CallMe: # Class
def App(): # Method one
...
def Foo(): # Method two
...
variable = "App" # Method to call
CallMe.variable() # Calling App()
但它不能。还有其他方法吗?
最佳答案
关于python - 从字符串调用方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1855558/