に私は私のmain.pyPythonのクラスを含める間違った行動
from modules import controller
ctrl = controller
help(ctrl)
print(ctrl.div(5,2))
に持っているとcontrollor.pyは次のとおりです。
class controller:
def div(self, x, y):
return x // y
私は私のメインを実行すると、私はエラーを得た:
Traceback (most recent call last):
File "...\main.py", line 8, in ?
print(ctrl.div(5,2))
AttributeError: 'module' object has no attribute 'div'
何が間違っていますか?
はい、それは初期投資を使用して動作しますが、ありません:あなたは括弧を追加する必要がコントローラクラスのインスタンスを作成するには – DrFalk3n