Calling a function of a module from a string with the function's name in Python で説明されているように、Python で文字列から関数を呼び出そうとしています 。
残念ながら、これは機能せず、Python インタープリターがエラーをスローします。
TypeError: 'str' object is not callable
def current(self, t):
if self.iMode == None:
return self.i
else:
return getattr(self, 'iMode')(t)
エラーは最後の行を参照しています。クラスで宣言されiMode
ている に設定されています。sinx(t)
誰でも私を助けてもらえますか?