开发者社区 问答 正文

关于模块使用,编程菜鸟问题?报错

桌面上创建了一个名为import1.py文件 

写入

def printer(x):
    print(x)

我想要引用这个模块。

新建一个文件

在交互模式下输入import module1

为什么会报错呢?

import module1.py

也是错的

展开
收起
爱吃鱼的程序员 2020-06-22 20:29:27 429 分享 版权
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    放在根目录下~~

    import1.py

    <spanstyle="line-height:1.5;font-size:10pt;"><spanstyle="line-height:1.5;font-size:10pt;">importmodule1?

    2020-06-22 20:29:44
    赞同 展开评论
问答地址: