我尝试使用 python 3.9.0 运行以下程序,出现错误:“模块”对象没有属性“div”

#in file calc.py i wrote the following code 


def Div(a,b):


    return a/b


#in another file i wrote following code to import module calc 


import calc


c= calc.Div(4,2)


print(c)


喵喔喔
浏览 42回答 1
1回答

跃然一笑

我以为 vscode 会自动保存文件,但后来我发现我们必须运行该程序才能保存文件。我的代码不起作用,因为我在进行更改后忘记保存 calc.py 。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python